Difference between revisions of "CoCoA:Reverse, Reversed"

From ApCoCoAWiki
(pushing XML rev. 1.46, again)
 
(No difference)

Latest revision as of 10:02, 24 October 2007

Reverse, Reversed

reverse a list

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]
-------------------------------

Syntax

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

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

Sort

Sorted

   <type>list</type>