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

append


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

Syntax

(append [expr ... ])
expr - 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)                            => NIL
(append 'a 'b)                      => B
(append '(a) '(b))                  => (A B)
(append 'a '(b))                    => (B)
(append '(a) 'b)                    => (A . B)
(append '(a) nil)                   => (A)
(append (list 'a 'b) (list 'c 'd))  => (A B C D)
(append '(a (b)) '(c (d)))          => (A (B) C (D))
(append '(a) nil nil nil '(b))      => (A B)
(append '(a) '(nil) '(b))           => (A NIL B)

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

See also:

  Back to Top


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