tricu

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

prepend.scp (289B)


      1 !export prepend
      2 -- Constant-time list constructor for use as a fold worker.
      3 -- Input: (accumulator list, element); state: ignored. Returns the new list
      4 -- [element | accumulator], without walking or modifying its existing tail.
      5 consumer prepend
      6   (accumulator, x) @ _ => [x | accumulator]