reverse

reverse xs returns the elements of xs in reverse order. xs must be finite.

Laziness

reverse is lazy in its elements.
>>> head (reverse [undefined, 1])
1
>>> reverse (1 : 2 : undefined)
*** Exception: Prelude.undefined

Examples

>>> reverse []
[]
>>> reverse [42]
[42]
>>> reverse [2,5,7]
[7,5,2]
>>> reverse [1..]
* Hangs forever *
reverse a finite NonEmpty stream.
O(n) reverse xs efficiently returns the elements of xs in reverse order.
O(n) reverse xs returns the elements of xs in reverse order.
O(n) reverse xs efficiently returns the elements of xs in reverse order.
O(n) Reverse the characters of a Stream returning Text. Properties
reverse . stream = reverse
O(n) reverse t returns the elements of t in reverse order.
The reverse of a sequence.
reverse xs returns the elements of xs in reverse order. xs must be finite.
>>> reverse []
[]

>>> reverse [42]
[42]

>>> reverse [2,5,7]
[7,5,2]

>>> reverse [1..]
* Hangs forever *
Reverse a bytearray
reverse xs returns the elements of xs in reverse order. xs must be finite.
O(n) Reverse the characters of a string. Example:
>>> T.reverse "desrever"
"reversed"
Subject to fusion.
O(n) Reverse a vector
O(n) Reverse a vector
O(n) Reverse a vector
O(n) Reverse a vector
Reverse a sequence
> reverse "hello world"
"dlrow olleh"
Reverse characters in ShortText.
>>> reverse "star live desserts"
"stressed evil rats"
reverse (singleton c) == singleton c
reverse (reverse t) == t
O(n). The reverse of a sequence.
Reverse chunks but not the bytes within each chunk.