Reputation: 1735
The following code:
(require '[clojure.set])
(println (clojure.set/difference '("a" "b" "c" "d") '("c" "d" "e" "f")))
gives me the following error:
java.lang.ClassCastException: clojure.lang.PersistentList (repl-1:47)
I don't understand what I'm doing wrong. Shouldn't this print out ("a" "b")?
Upvotes: 5
Views: 3625
Reputation: 381
I think you don't need to require '[clojure.set]
. It seems to be automatically loaded with core. Just starting a repl, and typing the below works (at least for me).
user=> (clojure.set/difference (set '(1 2 3)) (set '(3 4 5)))
\#{1 2}
Upvotes: 4
Reputation: 1484
Those are lists, not sets.
(println (clojure.set/difference #{"a" "b" "c" "d"} #{"c" "d" "e" "f"}))
Upvotes: 15