Documentation for routine reverse

Documentation for routine reverse, assembled from the following types:

class Any

From Any

(Any) routine reverse

Defined as:

multi sub    reverse(*@list  --> Seq:D)
multi method reverse(List:D: --> Seq:D)

Returns a Seq say reverse ^10; # OUTPUT: «(9 8 7 6 5 4 3 2 1 0)␤»

class List

From List

(List) routine reverse

Defined as:

multi sub    reverse(*@list  --> Seq:D)
multi method reverse(List:D: --> Seq:D)

Returns a Seq say reverse ^10; # OUTPUT: «(9 8 7 6 5 4 3 2 1 0)␤»

class Range

From Range

(Range) method reverse

method reverse(Range:D: --> Seq:D)

Returns a Seq where all elements that the Range represents have been reversed. Note that reversing an infinite Range won't produce any meaningful results.

say (1^..5).reverse;                              # OUTPUT: «(5 4 3 2)␤» 
say ('a'..'d').reverse;                           # OUTPUT: «(d c b a)␤» 
say (1..Inf).reverse;                             # OUTPUT: «(Inf Inf Inf ...)␤» 

class Supply

From Supply

(Supply) method reverse

method reverse(Supply:D: --> Supply:D)

Waits until the given supply is done, then creates a supply to which all values seen are emitted in reverse order.