4 ms·
;; Any programmer reading HN long enough to experiment with some lisp / clojure ;) (defn factorial [n] (apply * (range 1 (+ n 1))))
by Torn 17y ago
;; Any programmer reading HN long enough to experiment with some lisp / clojure ;)
(defn factorial [n]
(apply * (range 1 (+ n 1))))
- brehaut 17y agoI was torn between those two formulations, but decided on the reduce because the academic purity of an implicit hylomorphism ;) However, your formulation is more idiomatic of a lispy solution.