On Thu, Jun 18, 2009 at 1:21 AM, Rowdy Rednose<[email protected]> wrote:
>
> I've come up with this:
>
> (defn inc-values-in-map
>  [map keys]
>  (merge-with + map (zipmap keys (repeat 1))))

I'm glad you found a solution you liked better, but I like
how succinct this one is.

However, I would offer a friendly recommendation against
using the names of built-in functions for locals and
arguments.  I know it can be hard to know about all the core
names, but both 'map' and 'keys' are functions commonly used
in operations like this.  I spent longer than I'd like to
admit staring at "(merge-with + map ..." trying to figure
out what merge-with was going to do with a second function
parameter.  When I re-use names like that I always end up
confusing myself eventually.

--Chouser

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to