method tail

Documentation for method tail assembled from the following types:

class List

From List

(List) method tail

Defined as:

method tail(List:D: Int(Cool$number = 1 --> Seq:D)

Returns a Seq containing the last NUMBER items of the list. Returns an empty Seq if NUMBER <= 0. Defaults to the last element if no NUMBER is specified. Throws an exception if the list is lazy.


say ^10 .tail(5);      # OUTPUT: «(5 6 7 8 9)␤» 
say ^∞ .tail(5);       # Cannot tail a lazy list 
say ^10 .tail;         # OUTPUT: «(9)␤» 
say ^∞ .tail;        # Cannot tail a lazy list 

class Supply

From Supply

(Supply) method tail

method tail(Supply:D: Int(Cool$number = 1 --> Supply:D)

Creates a "tail" supply with the same semantics as List.tail.

my $s = Supply.from-list(41032);
my $ts = $s.tail(2);
$ts.tap(&say);           # OUTPUT: «3␤2␤»