Skip to content

Commit 07a56a2

Browse files
committed
Adds tail refs |1494
1 parent 7c43c86 commit 07a56a2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

doc/Type/Any.pod6

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,23 @@ to return all but the last elements:
11531153
11541154
say (^10).head( * - 3 );# OUTPUT: «(0 1 2 3 4 5 6)␤»
11551155
1156+
=head2 method tail
1157+
1158+
Defined as:
1159+
1160+
multi method tail() is raw
1161+
multi method tail($n)
1162+
1163+
Returns the last or the list of the C<$n> last elements of an object. C<$n> can
1164+
be a C<Callable>, usually a C<WhateverCode>, which will be used to get all but
1165+
the first C<n> elements of the object.
1166+
1167+
=for code
1168+
say (^12).reverse.tail ; # OUTPUT: «0␤»
1169+
say (^12).reverse.tail(3); # OUTPUT: «(2 1 0)␤»
1170+
say (^12).reverse.tail(*-7); # OUTPUT: «(4 3 2 1 0)␤»
1171+
1172+
11561173
=head2 method tree
11571174
11581175
Defined as:

0 commit comments

Comments
 (0)