Documentation for routine head

Documentation for routine head, assembled from the following types:

class Any

From Any

(Any) method head

Defined As:

    method head(--> TODO)

TODO

class List

From List

(List) method head

Defined as:

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

Returns the first NUMBER items of the list. Returns an empty list if NUMBER <= 0. Defaults to the first element seen if no NUMBER specified.

Examples:

say ^10 .head(5);      # OUTPUT: «(0 1 2 3 4)␤» 
say ^Inf .head(5);     # OUTPUT: «(0 1 2 3 4)␤» 
say ^10 .head;         # OUTPUT: «(0)␤» 
say ^Inf .head;        # OUTPUT: «(0)␤» 

class Supply

From Supply

(Supply) method head

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

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