4 ms·
Thanks 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))))
by mnemonik 16y ago
Thanks 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 16y agoThat's an actual pattern match. Might as well use matchure ;) (use 'matchure) (defn-match factorial ([0] 1) ([?x] (* x (factorial (dec x)))))