Lambder
Lambder

Reputation: 2993

Idiomatic equivalent of following Clojure code

Is there any special form or function in Clojure which is an equivalent of:

(defn foo [ob col f] 
  (reduce 
     #(f %1 %2) 
     ob col))

Basically something like doto but working on Clojure data-structures not on mutable java objects.

Upvotes: 1

Views: 80

Answers (1)

Leonid Beschastny
Leonid Beschastny

Reputation: 51440

Your code looks fine, but it may be simplified to:

(reduce f ob coll)

Upvotes: 5

Related Questions