2

Context

I apologize for this question being soft / philosophical; it's a set of ideas / observations / intuition that I can't formalize.

I've recently been writing large applications in Clojure, and playing with * clojure's match macro * rule dispatch systems of (1) moustache and (2) compojure * com.cederick's friend for security

What I like about all three -- is that rather than objects having functions, all three involve some explicit form of pattern matching to dispatch what happens next.

Question

Is there a general programming technique behind this? If so, what is it called? Where else does this pattern show up, and how can I learn more about it?

Thanks!

2
  • 1
    You've just seen a tip of an iceberg, not a very clean and consistent implementation of a proper pattern matching-centric approach. In order to get an idea of what this thing is all about, take a look at the Term Rewriting Systems (e.g., amazon.co.uk/Term-Rewriting-That-Franz-Baader/dp/0521779200). It also worth looking at the Wolfram Mathematica, which is mostly built around this idea. Commented Jun 27, 2012 at 8:45
  • Can you recommend a book on Mathematica which demonstrates the full power of term rewriting systems?? Ideally something subtitled "mind stretching recipes with mathematica". Commented Jun 27, 2012 at 20:30

1 Answer 1

3

Pattern matching is currently not part of clojure/core right now, but you can use multimethod, cond, case macro , and the https://github.com/clojure/core.match library.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.