Skip to content

Commit 3688a59

Browse files
committed
List.rotate returns a Seq since Rakudo 2020.06
ref #3495 While here flesh out a bit the routine description and adopt a more common example style.
1 parent 1dbce8a commit 3688a59

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

doc/Type/List.pod6

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -800,15 +800,19 @@ Examples:
800800
801801
Defined as:
802802
803-
multi sub rotate(@list, Int:D $n = 1 --> List:D)
804-
multi method rotate(List:D: Int:D $n = 1 --> List:D)
803+
multi sub rotate(@list, Int:D $n = 1 --> Seq:D)
804+
multi method rotate(List:D: Int:D $n = 1 --> Seq:D)
805805
806-
Returns the list rotated by C<$n> elements.
806+
Returns a L«C<Seq>|/type/Seq» with the list elements rotated to the left
807+
when C<$n> is positive or to the right otherwise.
807808
808809
Examples:
809810
810-
<a b c d e>.rotate(2); # <c d e a b>
811-
<a b c d e>.rotate(-1); # <e a b c d>
811+
say <a b c d e>.rotate(2); # OUTPUT: (c d e a b)
812+
say <a b c d e>.rotate(-1); # OUTPUT: (e a b c d)
813+
814+
B<Note>: Before Rakudo version 2020.06 a new C<List> was returned instead
815+
of a C<Seq>.
812816
813817
=head2 routine sort
814818

0 commit comments

Comments
 (0)