Ken Wesson <kwess...@gmail.com> writes:

> and to encapsulate as a function:
>
> (defn fmap [f m]
>   (into {}
>     (for [[k v] m]
>       [k (f v)])))

Here, "fmap" is a poor choice of name, if it's meant to be a reference
to Haskell's function of the same name. It's not obvious to me that
mapping a function over a map should just apply the function to the
values. Yes, applying the function to the keys instead could yield
duplicates, but just because one choice of behavior isn't promising
doesn't make the other choice obviously valid.

If you called your function, say, "fmap-values" I would not have
complained.

-- 
Steven E. Harris

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