git @ Cat's Eye Technologies Robin / 0.7 stdlib / append.robin
0.7

Tree @0.7 (Download .tar.gz)

append.robin @0.7raw · history · blame

;'<<SPEC'

    -> Tests for functionality "Evaluate Robin Expression (with List)"

`append` evaluates both of its arguments to lists.  It then
evaluates to a list which is the concatenation of these lists.

    |   (append (list 1 2 3) (list 4 5 6))
    = (1 2 3 4 5 6)

    |   (append () ())
    = ()

'<<SPEC'

(define append (fun (li new-tail)
  (bind append-r (fun (self li new-tail)
    (if (empty? li)
      new-tail
      (prepend (head li) (self self (tail li) new-tail))))
  (append-r append-r li new-tail))))