For those browsing the source, I'll give a quick run through of what's going on.
1. A "pattern matrix" is built using the given variables and pattern rows. A Pattern row is a pair of matches and a result. Example: match.core=> (build-matrix [x y] [1 0] 0 [0 1] 1) #match.core.PatternMatrix[[#match.core.PatternRow[[<LiteralPattern: 1> <LiteralPattern: 0>], 0, nil] ;; results in 0 #match.core.PatternRow[[<LiteralPattern: 0> <LiteralPattern: 1>], 1, nil]], ;; results in 0 [x y]] ;; the variables to match 2. The pattern matrix is "compiled" into a decision tree, a DAG. Switch nodes can take multiple routes down the tree, depending on which ":case" matches the ":occurance". Example: match.core=> (-> (build-matrix [x y] [1 0] 0 [0 1] 1) compile) #match.core.SwitchNode{:occurrence x, :cases ([<LiteralPattern: 0> #match.core.SwitchNode{:occurrence y, :cases ([<LiteralPattern: 1> #match.core.LeafNode{:value 1, :bindings nil}]), :default #match.core.FailNode{}}] [<LiteralPattern: 1> #match.core.SwitchNode{:occurrence y, :cases ([<LiteralPattern: 0> #match.core.LeafNode{:value 0, :bindings nil}]), :default #match.core.FailNode{}}]), :default #match.core.FailNode{}} 3. The DAG is then converted to the equivalent Clojure code. match.core=> (-> (build-matrix [x y] [1 0] 0 [0 1] 1) compile to-clj source-pprint) (cond (= x 0) (cond (= y 1) 1 :else (throw (java.lang.Exception. "Found FailNode"))) (= x 1) (cond (= y 0) 0 :else (throw (java.lang.Exception. "Found FailNode"))) :else (throw (java.lang.Exception. "Found FailNode"))) nil Ambrose -- 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