On Fri, Apr 13, 2012 at 3:33 AM, Vinzent <ru.vinz...@gmail.com> wrote: > Just like Boolean's javadoc puts a strong > emphasis on the fact that public Boolean(boolean value) constructor usually > shouldn't be used, clojure's docstring should say that (= x false) may give > you a result which will confuse you, so you'd better use 'false?' instead.
(def f (Boolean. false)) (false? f) ;; => false (true? f) ;; => false (= f false) ;; => true (if f :t :f) ;; => :t So 'false?' doesn't help you here. No one should be using (Boolean. false) in Clojure code - we have true / false. Why create a Java object whose documentation says not to do it? So if anyone runs into this problem _in real world code_ it's because they are calling a Java API that somehow returns a Java Boolean object embedded in the result. If you are working with a Java data structure full of _Objects_ then you need to take care of converting those Object instances into appropriate Clojure values. Calling (boolean v) is sufficient to convert the Java Object to a Clojure true/false value. -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ "Perfection is the enemy of the good." -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en