Re: reduce vs fold

2013-12-03 Thread Daniel
Don't you need to supply a combiner for fold? /no-experience -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with you

Re: reduce vs fold

2013-12-03 Thread James Reeves
Hi Caleb, This surprised me as well. It seems that if you try to fold a map, the function has two arguments: (r/fold + (r/map (fn [k v] v) {:a 1 :b 2})) ;; works (r/reduce + (r/map (fn [k v] v) {:a 1 :b 2})) ;; doesn't work (r/reduce + (r/map (fn [[k v]] v) {:a 1 :b 2})) ;; works (r/

reduce vs fold

2013-12-02 Thread cloverethos
Hi everyone, Let d be some map, says {1 3/5, 2 1/5, 3 1/5} why (reduce + (map #(% 1) d)) => 1 while (fold + (map #(% 1) d)) => ArityException Wrong number of args (2) passed to The reduce,fold, and map are those in the reducers namespace. Can someone explain to me? Thanks - Caleb -- -- You r