On Wed, Sep 28, 2011 at 7:29 PM, Michael Jaaka <michael.ja...@googlemail.com> wrote: > Do you know any lib for making diff from nested structures? > (diff [ 1 2 3 { 2 3 4 [ 1 2 { 1 2 3 4} ] } #{ 4 5 } ] [ 1 3 { 2 3 4 [ 1 4 { > 2 2 3 5} ] } #{ 4 5 } ] ) > -> [ 2 { [ 2 { 1 2 3 4 } ] } ] > as you can see it behaves like clojure.set/difference > and better if you would point the keys in map to keep remaining > (diff [ 1 2 3 { 2 3 4 [ 1 2 { 1 2 3 4 :tag "me" } ] } #{ 4 5 } ] [ 1 3 { 2 > 3 4 [ 1 4 { 2 2 3 5 :tag "me" } ] } #{ 4 5 } ] :keep [ :tag ] ) > -> [ 2 { [ 2 { 1 2 3 4 :tag "me" } ] } ] > This tool would allow to compare XML documents in form got from reading them > by clojure.xml lib.
Clojure now has clojure.data/diff to accomplish this task - https://github.com/clojure/clojure/blob/master/src/clj/clojure/data.clj Regards, BG -- Baishampayan Ghose b.ghose at gmail.com -- 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