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

rest


Type:   -   function (subr)
Source:   -   xlinit.lsp

Syntax

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

Description

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

Examples

(rest '(a b c))                         ; returns (B C)
(rest '((a b) c d))                     ; returns (C D)
(rest NIL)                              ; returns NIL
(rest 'a)                               ; error: bad argument type
(rest '(a))                             ; returns NIL

(setq sisters '(virginia vicki cindy))  ; set up variable SISTERS
(first sisters)                         ; returns VIRGINIA
(rest sisters)                          ; returns (VICKI CINDY)

Note: The 'rest' function is set to the same code as the cdr function.

See the rest function in the XLISP 2.0 manual.

  Back to Top


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