store/[org.clojure/clojure "1.9.0"] clj::clojure.data/diff

Official Documentation

Add notes
Arities
==================================================
   [a b]

Docstring
==================================================
  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.

Source

(defn 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."
  {:added "1.3"}
  [a b]
  (if (= a b)
    [nil nil a]
    (if (= (equality-partition a) (equality-partition b))
      (diff-similar a b)
      (atom-diff a b))))

Example 1

Edit
(require '[clojure.data :refer [diff]])
(def uno {:same "same", :different "one"})
(def dos {:same "same", :different "two", :onlyhere "whatever"})

(diff uno dos)
;; => ({:different "one"}                       ; different in lhs
;;     {:onlyhere "whatever", :different "two"} ; different in rhs
;;     {:same "same"})                          ; same in both

(diff {:a 1} {:a 1 :b 2})
;; => (nil
;;     {:b 2}
;;     {:a 1})

Uses on crossclj