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

append


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

Syntax

(append [expr1 ... ])
exprN - a list or list expression
returns - the new list

Description

The 'append' function takes an arbitrary number of lists and splices them together into a single list. This single list is returned. If an empty list NIL is appended, it has no effect, it does not appear in the final list. [Remember that '(nil) is not an empty list.] If a list is appended to an atom, it also has no effect and the atom will not appear in the final list.

Examples

(append)                            ; returns NIL
(append 'a 'b)                      ; returns B
(append '(a) '(b))                  ; returns (A B)
(append 'a '(b))                    ; returns (B)
(append '(a) 'b)                    ; returns (A . B)
(append '(a) nil)                   ; returns (A)
(append (list 'a 'b) (list 'c 'd))  ; returns (A B C D)
(append '(a (b)) '(c (d)))          ; returns (A (B) C (D))
(append '(a) nil nil nil '(b))      ; returns (A B)
(append '(a) '(nil) '(b))           ; returns (A NIL B)

Note: If a list is appended to an atom, XLISP raises no error, the atom just disappears!

See the append function in the XLISP 2.0 manual.

  Back to Top


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