## Clojure: Anonymous Function and its Shorthand

Just enough confusion to almost skip this part. But made it eventually. ?

(def sum #(reduce + %)) (def avg #(/ (sum %) (count %))) (defn stats [numbers] (map #(% numbers) [sum count avg])) (defn stats-long [numbers] (map (fn [f] (f numbers)) [sum count avg])) (stats [1 2 3]) ;=> (6 3 2) (stats-long [1 2 3]) ;=> (6 3 2) (stats [8 6 10 13 29]) ;=> (66 5 66/5) (stats-long [8 6 10 13 29]) ;=> (66 5 66/5)