On Mar 11, 2009, at 11:11 PM, Raffael Cavallaro wrote:

user=> (use 'clojure.set)
nil
user=> (set (list [:a 1] [:b 2]))
#{[:b 2] [:a 1]}
user=> (set (list [:a 1] [:b 2] [:c 3]))
#{[:b 2] [:c 3] [:a 1]}
user=> (difference *1 *2)
#{[:c 3]}
user=> (difference (set (list [:a 1] [:b 2])) (set (list [:a 1] [:b 2]
[:c 3])))
#{}

Is this a bug or am I just not understanding how difference is
supposed to work?

*1 gives the most recently evaluated value. *2 gives the one before that. The two tests you showed have the arguments to difference swapped.

Here are the expressions and results in a simplified notation:

#{a b c} - #{a b} => #{c}

#{a b} - #{a b c} => #{}

--Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to