REVERSE INDEX

REVERSE _ _ _ _ _ _ _ _ _ _ _ _ operator

The reverse operator returns a list that is the reverse of the list it is given.

syntax:

reverse(<list>) or reverse <list>

<list> must be a list.

examples:


aa := {c,b,a,{x**2,z**3},y}; 

                 2  3
  AA := {C,B,A,{X ,Z },Y} 


reverse aa; 

       2  3
  {Y,{X ,Z },A,B,C} 


reverse(q . reverse aa); 

           2  3
  {C,B,A,{X ,Z },Y,Q}

reverseand cons can be used together to add a new element to the end of a list (. adds its new element to the beginning). The reverse operator uses a noticeable amount of system resources, especially if the list is long. If you are doing much heavy-duty list manipulation, you should probably design your algorithms to avoid much reversing of lists. A moderate amount of list reversing is no problem.