t3x.org / sketchy / library / append.html
SketchyLISP
Reference
  Copyright (C) 2007
Nils M Holm

append

Conformance: R5RS Scheme

Purpose: Append lists. The last argument to append may be an atom, resulting in an improper list.

Arguments:
A... - lists

Implementation:

(define (append . a)
  (letrec
    ((append2
       (lambda (a b)
         (cond ((null? a) b)
           (else (append2 (cdr a) (cons (car a) b))))))
     (_append
       (lambda (a b)
         (cond ((null? b) a)
           (else (append2 (reverse a) b))))))
    (fold-left _append '() a)))

Example:

(append '(a b) '(c d) '(e f)) 
=> (a b c d e f)

See also:
reverse, length, map, equal?, list?.