I am trying to understand some behaviour I have noticed in Clojure.
It is possible to create a let binding with the same binding-name repeated multiple times:
(let [a 1 a 2 a b] a)
; (= a 2)
(let [a 1 a 2 a 3] a)
; (= a 3)
I understand that let bindings are evaluated, and this all mostly makes sense.
My understanding from the docs is that "Locals created with let are not variables. Once created their values never change!"
Does the above syntax actually change the value of the bindings?
This feels like it should raise an error.
As a sort of side note:
Interestingly you can output the above as JS with clojurescript:
var a__36584 = 1, b__36585 = 2, a__36586 = b__36585;
var a__30671 = 1, a__30672 = 2, a__30673 = 3;
Here we can see that the values are all actually distinct variables, which points to what is happening under the covers, but some clarification would be very helpful.