I'm mapping a function that throws an exception over a collection: => (def mapped (map (fn [_] (throw (Exception.))) [1 2 3])) #'user/mapped
'map' is lazy so we're not expecting to see the exception until we're trying to access the result: => mapped Exception user/fn--709 (NO_SOURCE_FILE:1) All good, let's do that again: => mapped () Whoops! Is this by design? Why? Where does that empty sequence come from? 'map' is really just calling the lazy-seq macro but doing this with lazy seq works just fine: => (def lazy (lazy-seq (throw (Exception.)))) #'user/lazy => lazy Exception user/fn--733 (NO_SOURCE_FILE:1) => lazy Exception user/fn--733 (NO_SOURCE_FILE:1) Same exception over and over again as it should be. I stared at the implementations of 'map' and lazy-seq/LazySeq for some hours but I really can't see it. Cheers -- hank -- 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