Clojure for loops don't work


It appears to me that for loops don’t work properly in Clojure. For the Temperatures puzzle I reduced the code to this very basic form:

(ns Solution

(defn -main [& args]
    (for [i (range 1)] (println (inc i))))

The expected behaviour is to print


, and pass the first test. I tested it in a Clojure REPL.

The actual result is

Found: Nothing
Expected: 1

If Clojure for loop was defective, I’m pretty sure it would has been detected 10 years ago. Maybe you should try the following code snippet then take a look at the Clojure documentation on laziness. :zzz:

(ns Solution
(defn -main [& args]
    (dorun (for [i (range 1)] (println (inc i)))))

Thanks for the help! I was thinking it was broken on, since it worked just fine in my local REPL.

I find the same problem.
for is not working anywhere, puzzel or clash of code. I need to modify a loop instead.