How about

(swap! game-objects (fn [objects] (into {} (for [[k v] objects] [k (apply f
v args)])))

?

For large maps, it will use a transient map and assoc! instead of assoc,
that may result in a speedup.

Laszlo

2013/1/22 Stephen Compall <stephen.comp...@gmail.com>

> On Jan 21, 2013 3:28 PM, "Jim - FooBar();" <jimpil1...@gmail.com> wrote:
> > ...or you can go all the way, skipping reset! completely:
> >
> > (swap! game-objects (fn [objects] (reduce-kv #(assoc % %2 (update-object
> %3)) {} objects) ))
>
> Which also has the benefit of being safe, unlike any reset!-based update.
>
> --
> Stephen Compall
> If anyone in the MSA is online, you should watch this flythrough.
>
> --
> 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
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>



-- 
László Török

-- 
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 your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to