next up previous
Contents Next: if (SPECIAL FORM) Up: Appendix: Selected LISP Previous: evenpoddp (PREDICATES)

first (FUNCTION)

Format: (first <exp>)

Required arguments: 1

<exp>: any LISP expression which returns a list

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


> (first '(1 2 3))

> (first '((a (b (c)) d) e (f)))
(A (B (C)) D)

> (first ())

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

© Colin Allen & Maneesh Dhagat
November 1999