XLISP cdr

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference

# cdr

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

## Syntax

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

## Description

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

The 'cdr' function returns the same result as the rest function.

## Examples

    (cdr '(a b c))       => (B C)
    (cdr '((a b) c d))   => (C D)
    (cdr nil)            => NIL
    (cdr 'a)             => error: bad argument type
    (cdr '(a))           => NIL
    (setq ben '(a b c))  =>
    (cdr ben)            => (B C)

See also:

- Contents → List Functions
- Tutorials → Lisp Hints → List Accessors

Back to Top

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference