next up previous
Contents Next: reverse (FUNCTION) Up: Appendix: Selected Lisp Previous: read (FUNCTION)

rest (FUNCTION)

Format: (rest <exp>)

Required arguments: 1

<exp>: any Lisp expression which returns a list

The argument expression must evaluate to a list; rest returns all but the first element of this list. If the list is empty, i.e. is nil, rest returns nil.

Examples:

> (rest '(1 2 3))
(2 3)

> (rest '((a (b (c)) d) e (f)))
(E (F))

> (rest '(z))
NIL

> (rest ())
NIL

> (rest 'a)
Error: A is not of type LIST



© Colin Allen & Maneesh Dhagat
February 2006