Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where is fmap (or how to apply a fn to every value of a map)

Tags:

clojure

I am trying to apply a function to every value of a map. fmap does the job. But what namespace has it moved to?

I also have written the below implementation, but I think this could be better -

(defn map-over
  [f m]
  (->>
   (map (fn [[k v]]
         {k (f v)})
        m)
   (into {})))
like image 365
murtaza52 Avatar asked Apr 06 '13 06:04

murtaza52


1 Answers

The migration page shows that clojure.contrib.generic has been migrated to algo.generic.

like image 88
John Szakmeister Avatar answered Nov 07 '22 11:11

John Szakmeister