Closed plexus closed 1 year ago
Since order doesn't matter, I think we could also use set operations or clojure.data/diff
for this.
I'm working on a fix. Same for maps:
(let [s {false 0, 0 0}]
(ddiff/diff s s))
;; => {{:+ 0} 0, false 0, {:- 0} 0}
The perils of using sets as predicates....
(filter #{5} (range 10)) ;;=> (5)
(filter #{false} [true false]) ;;=> ()
We currently handle sets with the same logic that we use for sequential collection, but sets have no ordering, leading to issues. For instance, even when comparing a set with itself ddiff may imagine there are differences.
I think we want to add a separate
diff-set
function, which loops over the keys of set A, marking any element that's absent in set B as a deletion, and then runs over any remaining elemnts in set B, marking them as additions. We don't mark any as replacements.