Ad

My take on a maybe more clojure-like solution using reduce:

Code
Diff
  • (ns factorial.core)
    
    (defn factorial
      [n]
      (->> (inc n)
           (range 1)
           (reduce *)))
    
    • (ns factorial.core)
    • (defn factorial [n] (eval (cons * (cons 1 (range 2 (+ 1 n))))))
    • (defn factorial
    • [n]
    • (->> (inc n)
    • (range 1)
    • (reduce *)))