3 ms·
How does this compare to https://github.com/clojure/core.match https://github.com/clojure/core.match ? He mentions that core.match is better at efficiently com
by codewright 14y ago
How does this compare to https://github.com/clojure/core.match https://github.com/clojure/core.match ?
He mentions that core.match is better at efficiently compiling complicated patterns, but little else is said as to exactly why strucjure was made rather than just using core.match.
- jamii 14y agoAuthor here. Strucjure has much more expressive power. Strucjure views are first-class values and can call other views (or recursively call themselves). This allows them to recognise eg context free grammars. Most of the examples in this post cannot be expressed with core.match Currently, this power comes at the expense of speed but I hope to be able to get reasonably close to core.match for simple patterns. Core.match will always be somewhat faster because it can reorder decisions and eliminate redundant tests.
- swannodette 14y agocore.match has a very narrow focus compared to Strucjure - efficient pattern matching and eventually efficient predicate dispatch. The generality of Strucjure should not be underestimated :)
- snikeris 14y agoI tried using core.match to turn arbitrary Clojure expressions into Disjunctive Normal Form. I found that doing sequence matching ended up being less readable than I expected (from memory): (match exp [([not ([or & rest] :seq)] :seq)] ...) From the looks of it, solving this problem using strucjure might be a little more elegant.