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

cdr


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

Syntax

(cdr expr)
expr - a list or list expression
returns - expr with the first element removed

Description

The 'cdr' function returns the remainder of a list or list expression after the first element of the list is removed. If the list is NIL , NIL is returned.

Examples

(cdr '(a b c))       ; returns (B C)
(cdr '((a b) c d))   ; returns (C D)
(cdr NIL)            ; returns NIL
(cdr 'a)             ; error: bad argument type
(cdr '(a))           ; returns NIL
(setq ben '(a b c))  ; set up variable BEN
(cdr ben)            ; returns (B C)

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

See the cdr function in the XLISP 2.0 manual.

  Back to Top


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