user=> (set/intersection nil #{1})
java.lang.NullPointerException (NO_SOURCE_FILE:0)
user=> (.printStackTrace *e)
java.lang.NullPointerException (NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:4186)
at clojure.core$eval__3830.invoke(core.clj:1647)
at clojure.main$repl__5568$fn__5586.invoke(main.clj:148)
at clojure.main$repl__5568.doInvoke(main.clj:145)
at clojure.lang.RestFn.invoke(RestFn.java:426)
at clojure.main$repl_opt__5610.invoke(main.clj:208)
at clojure.main$main__5645$fn__5647.invoke(main.clj:295)
at clojure.main$main__5645.doInvoke(main.clj:289)
at clojure.lang.RestFn.invoke(RestFn.java:402)
at clojure.lang.Var.invoke(Var.java:332)
at clojure.lang.AFn.applyToHelper(AFn.java:172)
at clojure.lang.Var.applyTo(Var.java:453)
at clojure.main.main(main.java:39)
Caused by: java.lang.NullPointerException
at clojure.core$disj__3445.invoke(core.clj:915)
at clojure.core$reduce__3173$fn__3176.invoke(core.clj:549)
at clojure.core$reduce__3173.invoke(core.clj:547)
at clojure.set$difference__5658.invoke(set.clj:19)
at clojure.set$intersection__5661.invoke(set.clj:24)
at user$eval__259.invoke(Unknown Source)
at clojure.lang.Compiler.eval(Compiler.java:4175)
... 12 more
nil
user=> (msg/select-messages msgs nil "OR" nil)
nil
user=> (set/intersection #{} nil)
#{}
The same is true for clojure.set/difference and everything else that
uses clojure.disj with nil for the first parameter.
Cheers,
nt
Am 29.01.2009 um 15:42 schrieb ntu...@googlemail.com:
> If its left argument is nil, "intersection" throws a NPE (Clojure
> rev. 1235):
> The same is true for clojure.set/difference and everything else that
> uses clojure.disj with nil for the first parameter.
IMHO, this is not a bug. nil is not a set, in particular not the empty
set.
Much in the same sense, that nil is not the empty list.
But one could argue, that accepting nil as empty set is a convenience.
Or that the bug is, that nil is accepted as second parameter for
intersection,
where a set is expected.
Sincerely
Meikel