XLISP first

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

# first

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

## Syntax

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

## Description

The 'first' 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

    (first '(a b c))               ; returns A
    (first '((a b) c d))           ; returns (A B)
    (first NIL)                    ; returns NIL
    (first 'a)                     ; error: bad argument type
    (setq children '(amanda ben))  ; set up variable CHILDREN
    (first children)               ; returns AMANDA

See the first function in the XLISP 2.0 manual.

Back to Top

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