chickadee » tree-rewrite » match-tree

match-tree TREE1 TREE2 ENVprocedure

A non-linear match of two ordered trees, one of which may contain variables.

TREE1 may contain variables (symbols with leading $ sign). TREE1 may contain several occurrences of the same variable. All these occurrences must match the same value. A variable match is entered into the environment. A variable _ is an exception: its match is never entered into the environment. The function returns the resulting environment or #f if the match fails.