XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next

car


Type:   -   function (subr)
Source:   -   xllist.c

Syntax

(car expr)
expr - a list or list expression
returns - the first element of the list

Description

The 'car' function returns the first element of the expression. If the first expression is itself a list, then the sublist is returned. If the list is NIL , NIL is returned.

Examples

(car '(a b c))        ; returns A
(car '((a b) c d))    ; returns (A B)
(car NIL)             ; returns NIL
(car 'a)              ; error: bad argument type
(setq bob '(1 2 3))   ; set up variable BOB
(car bob)             ; returns 1

Note: Instead of 'car' you can also use the first function if you find it easier to read or to remember. Both functions work exactly the same.

See the car function in the XLISP 2.0 manual.

  Back to Top


XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next