tricu

An interpreted language for exploring Tree Calculus
Log | Files | Refs | README | LICENSE

append.scp (336B)


      1 !export append
      2 -- Append two proper lists without changing their elements.
      3 -- Input: the left list; state: the suffix list. Example: [1 2] @ [3]
      4 -- produces [1 2 3]. This copies the left spine and shares the suffix.
      5 consumer append
      6   []       @ suffix => suffix -- no left elements remain
      7   [x | xs] @ suffix => [x | recur xs @ suffix]