matchure
matchure copied to clipboard
Blowing heap on if-match on or expression
When trying to construct a function for balancing a red-black tree we ran into a problem when constructing a set of four different patterns for matching a tree. The heap is blown when trying to compile the function below.
(defn balance [tree] (if-match [(or [:black [:red [:red ?a ?x ?b] ?y ?c] ?z ?d] [:black [:red ?a ?x [:red ?b ?y ?c]] ?z ?d] [:black ?a ?x [:red [:red ?b ?y ?c] ?z ?d]] [:black ?a ?x [:red ?b ?y [:red ?c ?z ?d]]]) tree] [:red [:black a x b] y [:black c z d]] tree))
For a complete example, please see this gist
Ouch. Thanks for the bug report. I'll look into this as soon as I can.