When I try to run the following code (from the REPL) in Clojure:
(dotimes [i 5] (.start (Thread. (fn [] (Thread/sleep (rand 1000)) (println (format 'Finished %d on %s' i (Thread/currentThread)))))))
I get the following error:
java.lang.Exception: Unable to resolve symbol: i in this context clojure.lang.Compiler$CompilerException: NO_SOURCE_FILE:6: Unable to resolve symbol: i in this context at clojure.lang.Compiler.analyze(Compiler.java:3713)
What am I doing wrong here?
Your code works for me using the latest SVN (1144).
Are you using the September 16 release? You almost have to use the SVN version of Clojure. It’s changing way too fast.