XLISP second

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

# second

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

## Syntax

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

## Description

The 'second' function returns the second element of a list or list expression. If the list is NIL , NIL is returned.

## Examples

    (second '(1 2 3))              ; returns 2
    (second NIL)                   ; returns NIL

    (setq carol '(a b c))          ; set up variable CAROL
    (first carol)                  ; returns A
    (second carol)                 ; returns B
    (rest carol)                   ; returns (B C)

    (setq children '(amanda ben))  ; set up variable CHILDREN
    (second children)              ; returns BEN

Note: This function is set to the same code as the cadr function.

See the second function in the XLISP 2.0 manual.

Back to Top

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