On 11.06.2009, at 06:52, alfred.morgan.al...@gmail.com wrote:

> Again, thanks for all the help.  One last question, though- how would
> I apply the 'map' function to an actual associative mapping?  I mean-
>
> (defn testFunc [x] (* x 2))
> (println (map testFunc {:a 1 :b 2 :c 3}))

(use 'clojure.contrib.generic.functor)

(println (fmap testFunc {:a 1 :b 2 :c 3}))

Prints:   {:c 6, :b 4, :a 2}

fmap maps a function on the values in a data structure, returning an  
equivalent data structure containing the function results. This is  
different from map that applies a function to a sequence and returns  
another sequence.

Konrad.


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