Friday, 15 March 2013

map - Using Clojure update-in with multiple keys -


I am trying to apply the function to all the elements in a map that matches a certain key.

  (def mymap {: a "a": b "b": c "c"}) (Update-in Mymop [: a: b] # (str "X -"% ))   

I hope

  {: a "xa", c "c",: b "xb"}   

But I get

Class class expansion in java.lang.String in clojure.lang.Angociative clojure.lang.RT.assoc (RT.java:702) Can not be cast

Can anyone help me with this?

update-in to update a key in the map ( At the level of a particular nest, [: a: b] inside the map value of the key: key: a.

Can be:

  (# commode% 1% 2 (str "X-" (% 1% 2)) mymap [: a: b])    

No comments:

Post a Comment