clojure.data/diff¶
Recursively compares a and b, returning a tuple of [things-only-in-a things-only-in-b things-in-both]. Comparison rules:
- For equal a and b, return [nil nil a].
- Maps are subdiffed where keys match and values differ.
- Sets are never subdiffed.
- All sequential things are treated as associative collections by their indexes, with results returned as vectors.
- Everything else (including strings!) is treated as an atom and compared for equality.
Examples¶
Note by Bost¶
See also https://github.com/lambdaisland/deep-diff2 "Deep diff Clojure data structures and pretty print the result"
Note by huahaiy¶
See https://github.com/juji-io/editscript "Editscript is a library designed to extract the differences between two Clojure/Clojurescript data structures as an 'editscript', which represents the minimal modification necessary to transform one to another"
Content from the matching ClojureDocs page, with authors credited on each contribution.