6 ms·
You can handle your particular case with Clojure's fn argument destructuring. No need for pattern matching.
by swannodette 17y ago
You can handle your particular case with Clojure's fn argument destructuring. No need for pattern matching.
- mnemonik 17y agoThanks for the info, didn't know you could do that! What about the classic factorial, though? (defn factorial ([0] 1) ([x] (* x (factorial (- x 1)))))
- swannodette 17y agoThat's an actual pattern match. Might as well use matchure ;) (use 'matchure) (defn-match factorial ([0] 1) ([?x] (* x (factorial (dec x)))))