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