2
votes

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!

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. - SK-logic
Can you recommend a book on Mathematica which demonstrates the full power of term rewriting systems?? Ideally something subtitled "mind stretching recipes with mathematica". - user1311390

1 Answers

3
votes

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.