Why does this not lead to the expected result?
(defn test-fn [] (do (println "start") (map #(println (+ % 1)) '(1 2 3)) (println "done")))
He outputs
start done
While I would expect
start 2 3 4 done
map lazy, but do not force it. If you want to force an evaluation of a lazy sequence, use doall or dorun .
map
do
doall
dorun
(defn test-fn [] (do (println "start") (dorun (map #(println (+ % 1)) '(1 2 3))) (println "done")))