This is not modifying the value it's creating a new scope with a new
version of x. The binding above is shorthand for:
(let [x 3]
(let [x 42]
(println x))
(println x))
;; prints:
42
3
Timothy
On Fri, Apr 4, 2014 at 10:23 AM, Plínio Balduino <[email protected]>wrote:
> Hi there
>
> I wrote this code expecting an error, but it worked:
>
> (let [x 3
> x (* valor 2)]
> x)
> ; 6
>
> Is It the expected behavior or, considering that a local binding could not
> be modified, it should really raise an error?
>
> Thank you
>
> Plínio
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
"One of the main causes of the fall of the Roman Empire was that-lacking
zero-they had no way to indicate successful termination of their C
programs."
(Robert Firth)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.