4 ms·
I agree for the most part, but incidentally you would never (def x 1) and then (def x 5) in a running program -- you would use an atom, ref, or var instead. Re
by dreish 17y ago
I agree for the most part, but incidentally you would never (def x 1) and then (def x 5) in a running program -- you would use an atom, ref, or var instead. Redefinition of a symbol is permitted so you don't have to quit and restart your REPL every time you rewrite a function.
A more meaningful objection is that you can shadow a local with a different local in Clojure, like this:
(let [a (some-calculation)
b (something-else)
a (some-function-of a b)]
a)
which is essentially what is being done in the Python code.
I don't think there are many strong arguments to make in favor of Clojure over Python other than concurrency and macros, and maybe the immutable hashes.
- bretthoerner 17y ago> you would never (def x 1) and then (def x 5) in a running program Right, I understand. It was the way the author stated 'x never changes' that made me believe he doesn't understand the difference between binding a name and changing a value.