I wouldn't say it is different, only that the REPL is doing an extra
step (printing) which forces the evaluation of that lazy sequence. As
James mentions, your code can force the evaluation of a lazy sequence
using doseq or dorun.
Lazy sequences are great when you get used to them but they can tri
Thanks James. So the repl behaves differently from some compiled code -
good to know!
I don't yet know about the "safe" issues "read-eval". This came with the
little template built by lein. But I'll read up on it.
On Saturday, October 8, 2016 at 10:11:29 PM UTC-4, James Reeves wrote:
>
>
>
>
On 9 October 2016 at 03:00, Phil Virgo wrote:
> WHY?
>
> The following prints 1/n 2/n 3/n fine in the repl
>
> (for [f [1 2 3]] (println f))
>
> But does nothing in this lein project (the "Hello World???" does print)
>
> (ns slide.core
> (:gen-class))
>
> (defn -main
> [& args]
> ;; work ar
WHY?
The following prints 1/n 2/n 3/n fine in the repl
(for [f [1 2 3]] (println f))
But does nothing in this lein project (the "Hello World???" does print)
(ns slide.core
(:gen-class))
(defn -main
[& args]
;; work around dangerous default behaviour in Clojure
(alter-var-root #'*rea