Hi, I love matcher-combinators! Are there any tricks for expressing "I don't care about the value itself, but I want to make sure the same value is used here as is used over there" (in some nested data structure)? This would make it much simpler to express certain types of invariants where you have identifiers like UUIDs or Datomic entity IDs whose generation you don't really control.
Cheeky proof of concept:
(def nothing (Object.))
(deftype SameContainer [^:volatile-mutable capture]
clojure.lang.IPersistentCollection
(equiv [_ other]
(if (identical? capture nothing)
(do (set! capture other)
true)
(identical? capture other))))
(defn same [] (->SameContainer nothing))
(let [x "some object"
y "other object"
data {:a x, :b y, :c [x y x]}
s1 (same)
s2 (same)]
(is (match? {:a s1, :b s2, :c [s1 s2 s1]}
data)))