Just checking performance versus the version i have been using i
noticed quite a difference
For 100000 runs over a small 10 key/value map
(defn fmap [keyf valf m]
(into {}
(for [[k v] m]
[(keyf k) (valf v)])))
550ms
(defn fmap2 [keyf valf m]
(-> (fn [inputmap [k v]]
(assoc inputmap (name k) (inc v)))
(reduce {} inputmap)))
250ms
On Dec 7, 7:50 am, Alex Baranosky <[email protected]>
wrote:
> Ahh apply does it again! I saw how the code be simplified, but just tonight
> learned how apply can be used in situations like this.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en