;; Any programmer reading HN long enough to experiment with some lisp / clojure ;)
(defn factorial [n]
(apply * (range 1 (+ n 1))))I 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.
(defn factorial [n] (reduce * (range 1 (inc n))))