up previous next
reverse, reversed    --    reverse a list


Syntax
reverse(ref L: LIST)
reversed(L: LIST): LIST

Description
The function reverse reverses the order of the elements of the list L ; it changes the value of L and returns nothing. The function reversed returns the reversed list without changing L .

Example
/**/  L := [1,2,3,4];
/**/  reverse(ref 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