Append
append concatenates two lists to form a single list. The first argument is copied; the second argument is reused (shared).
(append '(a b c) '(d e)) -> (a b c d e)
(defn append [x y] (if (empty? x) y (cons (first x) (append (rest x) y)) ) )
This version of append append is simple and elegant; it takes O(nx) time and O(nx) stack space. Time and stack space are independent of y, since y is reused but not processed.