Laurent PETIT <laurent.pe...@gmail.com> writes: Hi Laurent,
> For this to work, instance? would have to return logical true instead > of real true. I'm new to clojure, so please forgive any stupid questions. But you mean that (instance? java.lang.Integer 17) should return 17 instead of true, right? Seems plausible, but there's this corner case: (instance? java.lang.Boolean false) If it returned false, then instance? would be broken. So I guess the current behavior is correct. Maybe this can act as a workaround: --8<---------------cut here---------------start------------->8--- user> (defn maybe-print-int [n] (when-let [i (and (instance? java.lang.Integer n) n)] (println "Foo" i))) #'user/maybe-print-int user> (maybe-print-int 17) Foo 17 nil user> (maybe-print-int "A String") nil --8<---------------cut here---------------end--------------->8--- Bye, Tassilo --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---