up previous next
Reverse, Reversed

reverse a list
Syntax

Reverse(V:LIST):NULL
Reversed(L:LIST):NULL

where V is a variable containing a list in the first case.


Description
The the function Reverse reverses the order of the elements of the list in V, returning Null. It does not return the reversed list, but instead changes L itself. The function Reversed returns the reversed list without changing L.

Example
  L := [1,2,3,4];
  Reverse(L);
  L;  -- L has been modified
[4, 3, 2, 1]
-------------------------------
  M := [1,2,3,4];
  Reversed(M);  -- the reversed list is returned
[4, 3, 2, 1]
-------------------------------
  M;  -- M has not been modified
[1, 2, 3, 4]
-------------------------------


See Also