summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/clj/clojure/data.clj15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/clj/clojure/data.clj b/src/clj/clojure/data.clj
index f5730016..8f9a027d 100644
--- a/src/clj/clojure/data.clj
+++ b/src/clj/clojure/data.clj
@@ -72,12 +72,19 @@
java.util.Map
(equality-partition [x] :map))
+(defn- as-set-value
+ [s]
+ (if (set? s) s (into #{} s)))
+
(extend-protocol Diff
java.util.Set
- (diff-similar [a b]
- [(not-empty (set/difference a b))
- (not-empty (set/difference b a))
- (not-empty (set/intersection a b))])
+ (diff-similar
+ [a b]
+ (let [aval (as-set-value a)
+ bval (as-set-value b)]
+ [(not-empty (set/difference aval bval))
+ (not-empty (set/difference bval aval))
+ (not-empty (set/intersection aval bval))]))
java.util.List
(diff-similar [a b]