Oops, you're right; I was thinking about something else. And I have
another mistake in my function too—I meant:

  (defn transform-map [f a-map]
    (into {} (map #(vector (key %) (f (val %))) a-map)))

It's unfortunate that it's not in any standard library yet. I've used
this function in every single Clojure program that I've written. Ah,
well.

On Oct 10, 8:48 pm, Sean Devlin <francoisdev...@gmail.com> wrote:
> The short answer is no.
>
> This came up on the dev list here:
>
> http://groups.google.com/group/clojure-dev/browse_thread/thread/4b20e...
>
> Oh, and I'd write the function slightly differently
>
> (defn transform-map [f a-map] ...)
>
> The f implies a mapping operation.  pred implies a filter operation.
>
> On Oct 10, 8:40 pm, samppi <rbysam...@gmail.com> wrote:
>
>
>
> > Is there a function in the standard libraries that's equivalent to
> > this:
>
> >   (defn transform-map [pred a-map]
> >     (into {} (map (comp pred val) a-map)))
>
> >   (is (= {:a 4, :b 3}
> >            (transform-map inc {:a 3, :b 2})))
>
> > It's not like I can't write this myself; I use this a lot, though, and
> > I'm wondering if it's somewhere in the core or contrib. (I searched,
> > but I couldn't find it, either.)
--~--~---------~--~----~------------~-------~--~----~
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