XLISP car

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

# 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.

The 'car' function returns the same result as the first function.

## Examples

    (car '(a b c))       => A
    (car '((a b) c d))   => (A B)
    (car NIL)            => NIL
    (car 'a)             => error: bad argument type
    (setq bob '(1 2 3))  => (1 2 3)
    (car bob)            => 1

See also:

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

Back to Top

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