Examples of APPEND and NCONC clauses (ANSI and GNU Common Lisp Document)

Next: Examples of COUNT clause, Previous: Examples of COLLECT clause, Up: Value Accumulation Clauses

#### 6.1.3.2 Examples of APPEND and NCONC clauses

    ;; Use APPEND to concatenate some sublists.
      (loop for x in '((a) (b) ((c)))
            append x)
    ⇒  (A B (C))

    ;; NCONC some sublists together.  Note that only lists made by the
    ;; call to LIST are modified.
      (loop for i upfrom 0
            as x in '(a b (c))
            nconc (if (evenp i) (list x) nil))
    ⇒  (A (C))