vickychijwani / closer.js

:hammer_and_wrench: Clojure parser and core library in JavaScript, compatible with the Mozilla Parser API.
https://vickychijwani.github.io/closer.js
MIT License
83 stars 8 forks source link

"doseq" variables replacing variables outside of its scope #7

Closed Driphter closed 9 years ago

Driphter commented 10 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
vickychijwani commented 9 years ago

This is fixed now. doseq and dotimes correctly create their own lexical scopes.