tricu

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

succ.scp (392B)


      1 -- tricu's compact natural numbers: 0=Leaf; positive values are Fork(bit,
      2 -- higher bits), LSB first. Bit 0=Leaf, bit 1=Stem Leaf. Input is a
      3 -- canonical natural; there is deliberately no rule for malformed bit trees.
      4 consumer succBinary
      5   leaf                @ _ => (stem leaf, leaf)
      6   (leaf, higher)      @ _ => (stem leaf, higher)
      7   (stem leaf, higher) @ _ => (leaf, recur higher @ leaf)