next up previous contents index
Next: setFirst! Up: ListType Previous: rest   Contents   Index


reverse


Usage

reverse l
reverse! l


Signature

reverse: % $\to$ %


Parameter Type Description
l % a list


Returns

reverse(l) returns a copy of $l$ with the elements in reverse order, while reverse!(l) reverses $l$ without copying it.


Remarks

reverse! does not make a copy of $l$, which is therefore modified after the call. It is unsafe to use the variable $l$ after the call, unless it has been assigned to the result of the call, as in l := reverse! l.



Manuel Bronstein 2004-06-28