Wednesday, April 18, 2012

Clojure, merging two array of maps

I have two arrays of maps



1st is [{:a 1 :b 2 :d 6} {:a 2 :b 2} {:a 7 :b 7}]



2nd is [{:a 3 :c 3 :e 9 :y 7} {:a 2 :b 6 :c 8}]



depending on the value of a i.e. if its matches in 2nd array the '2nd map' should be merged with '1st map' and the resultant array of maps should be



Res should be [{:a 1 :b 2 :d 6} {:a 2 :b 6 :c 8} {:a 7 :b 7} {:a 3 :c 3 :e 9 :y 7}]



Can anyone help me on this. Thanks in advance.





No comments:

Post a Comment