shape.scp (441B)
1 -- Ordered patterns describe the tree itself, not a declared data type. 2 -- The first two rules overlap with the later stem rule; order matters. 3 -- `match` on an already captured subtree uses exactly the same patterns. 4 consumer shape 5 leaf @ _ => "Leaf" 6 stem leaf @ _ => "Stem Leaf" 7 stem child @ _ => match child of ( 8 (left, right) => "Stem of Fork" 9 | _ => "Stem of something else") 10 (left, right) @ _ => "Fork"