On Thursday, October 15, 2015 at 5:26:01 PM UTC-4, JvJ wrote:
>
> I just discovered clojure.data/diff, and it's great.  However, I'm not 
> sure how to recombine the results to get back the original.
>
> For instance, if (diff a b) = c, then how can I combine b and c to get 
> back to a?
>
>
Merge them:

(def a {:a 1 :b 2})
(def b {:b 2 :c 3})

(let [[only-a only-b both] (clojure.data/diff a b)]
   (println "original a:" a " is the same as " (merge only-a both))
   (println "original b:" b " is the same as " (merge only-b both)))

Cheers,
Sean
 

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to