What happens to second println statement? (Clojure repl)

Viewed 286

When I call this small function in the clojure REPL it only prints the first hello world, not hello mars. Why is that? It's not lazy (as far as I understand) otherwise the exception wouldn't get hit, in addition SO tells me println causes a flush.

(defn foo                                                                                                                                                           
     "I don't do a whole lot."                                                                                                                                         
     [x]                                                                                                                                                               
     (println x "Hello, World!")                                                                                                                                       
     (map (fn [x] (let [_ (println "Hello, Mars")                                                                                                                      
                        __ (throw (Exception. "talking to many planets"))]                                                                                             
                    { :aliens? false }                                                                                                                                 
                   )) [1 2 3])                                                                                                                                        
)    

Output:

(foo nil) nil Hello, World!

Exception talking to many planets test.repl/foo/fn--6580 (form-init13300486174634970.clj:5)

2 Answers
Related