Hacker News new | past | comments | ask | show | jobs | submit login

* This is the groundwork for bringing high performance predicate dispatch to Clojure. This is under explored territory for dynamic languages.

I really like the way how pattern matching (in Haskell, etc) is transformed into a bunch of case expressions, which can then be compiled into code where each argument is evaluated only once and each "then" expression is compiled only once (no duplicates).

However, to my best knowledge, it requires some static type information to make the compiling transformation possible. E.g. the Haskell compiler knows that a Maybe Bool can have only three possible values: Just True, Just False or Nothing.

How do you do this in Clojure with dynamic typing? This really intrigues me and you're really pushing the boundaries of dynamic languages and compiling here a little bit. Very interesting indeed!

* For the uninitiated: you can find good description of compiling pattern matching in Simon Peyton Jones's book here: http://research.microsoft.com/en-us/um/people/simonpj/papers...




This library will produce a decision tree where each argument is only tested once - no backtracking. How is a bit too much to explain here. I recommend the Maranget paper Compiling Pattern Matching to Good Decision Trees on which this work is based.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: