Thanks for your explanation On Friday, April 22, 2016 at 2:02:53 PM UTC-7, red...@gmail.com wrote: > > keys is lazy, you see the exception at the repl because printing out the > result forces the sequence, but if you don't do anything with the result > then it isn't forced, so no errors. > > On 04/22/2016 01:28 PM, Steve Riley wrote: > > I am trying to determine if a container, x, passed to a function, is a > > map or not. > > > > If I evaluation (keys x) at a REPL prompt, and, x is instantiated list, > > vector or set, I will get a java.lang.ClassCastException that some item > > in x cannot be cast to java.util.Map$Entry. > > > > On the other hand, if I evaluate (try (keys x) true), the form evaluates > > to true. It will also evaluation to true if I add a catch expression > > with the last value of false. I've tried catching both > > ClassCastException and just Exception. > > > > (try (/ 10 0) true (catch ArithmeticException _ "divide by zero!")) > > and (try (/ 10 1) true (catch ArithmeticException _ "divide by zero!")), > > for example, evaluate as expected. > > > > Is this a feature I don't understand? > > > > Some of you may recognize the 4Clojure problem I am working on. I'm not > > interested in solutions to that problem...just curious about this > > behavior and if there is something I am missing in the try (keys x) > > catch formulation. > > > > Many thanks > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clo...@googlegroups.com > <javascript:> > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+u...@googlegroups.com <javascript:> > > For more options, visit this group at > > http://groups.google.com/group/clojure?hl=en > > --- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To unsubscribe from this group and stop receiving emails from it, send > > an email to clojure+u...@googlegroups.com <javascript:> > > <mailto:clojure+u...@googlegroups.com <javascript:>>. > > For more options, visit https://groups.google.com/d/optout. > > > -- > And what is good, Phaedrus, > And what is not good— > Need we ask anyone to tell us these things? >
-- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.