Damn! That shadowing thing has tripped me up a bunch of times. I'm sheepish. Thanks for the reply.
And the type thing is just more of the same (more sheepish) - events do conspire against us. I'd been trying to track it down for quite a while. Appreciate the help. Best On Friday, February 15, 2019 at 9:32:02 AM UTC-5, Alex Miller wrote: > > What's the stack trace when you get an NPE? (pst *e) > > Are you shadowing a core function with your own `count` or something like > that? > > On Friday, February 15, 2019 at 8:27:55 AM UTC-6, KJO wrote: >> >> Hi- >> >> This one has me stumped. The following code snippet throws a >> NullPointerException and I just can't understand how it could. >> >> (if (set? t-val) >> (println t-val (type t-val))) >> >> It seems that if it's a set, it should have a set type. >> >> If I change the code to >> >> (if (set? t-val) >> (println t-val (count t-val))) >> >> It throws a ClassCastException >> with java.math.BigDecimal cannot be cast to clojure.lang.IFn >> >> The println is only there for debugging. I was seeing the count function >> throwing an exception further down in the code, and I couldn't understand >> why. Any ideas? >> >> t-val is defined in a let, but if I take it out and use the original >> value, the result is the same. I'm afraid I can't reproduce the error in >> the REPL using any of the values I captured. The only other thing I can >> offer is that it's being used in a reducing function over a lazy sequence. >> >> I'm stumped. >> >> Thanks >> >> -- 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.