Closed Driphter closed 9 years ago
Variables used in the scope of doseq are replacing the variables of the same name outside of its scope.
The following code results in:
TypeError: Cannot read property 'call' of null
(defn x [n] (+ n n)) (doseq [x (range 7)] (.log console x)) (.log console (x 10000))
Here's the same code (replacing "console.log" with "print") in the REPL at http://tryclj.com/ :
> (defn x [n] (+ n n)) #'sandbox5763/x > (doseq [x (range 7)] (print x)) 0123456nil > (print (x 10000)) 20000nil
This is fixed now. doseq and dotimes correctly create their own lexical scopes.
doseq
dotimes
Variables used in the scope of doseq are replacing the variables of the same name outside of its scope.
The following code results in:
Here's the same code (replacing "console.log" with "print") in the REPL at http://tryclj.com/ :