> Not to hijack the thread but...is there some reason clojure doesn't just > just call this pattern-matching? Is it different somehow?
I guess the simplest answer is "because it's destructuring, not pattern-matching" :) As Rich explained in the thread to which Stephen linked, pattern matching (at least as I know it in Erlang) is usually used primarily for dispatch -- a structure-analyzing switch, basically. Clojure's destructuring is a logical extension of Common Lisp's destructuring-bind, which takes an input list and binds variables to parts of the list. Clojure's destructuring does exactly what its name implies: it takes some structure and "de-structure"s it into its constituents. The pattern matching that Clojure does is just to correctly map the matching structure (and its variables) against the input. It's not used to match as part of a switch. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---