Ouch. Now I realized that it's exactly what happens when you do this to
debug a sequential binding.

(let [x 35
      _ (println "x is" x)
      y (* 35 3)
      _ (println "y is" y)]
  ; some code
)

Thank you for the elucidation.

Plínio


On Fri, Apr 4, 2014 at 1:36 PM, Timothy Baldridge <tbaldri...@gmail.com>wrote:

> That's correct, and often clojure compilers (like ClojureScript) many
> actually completely rename the variable to something else.
>
> Timothy
>
>
> On Fri, Apr 4, 2014 at 10:34 AM, Plínio Balduino <pbaldu...@gmail.com>wrote:
>
>> Thank you
>>
>> I imagined something like that. Anyway, as the second binding is
>> shadowing the first, there's no way to access the first value, right?
>>
>> Plínio
>>
>>
>> On Fri, Apr 4, 2014 at 1:26 PM, Timothy Baldridge 
>> <tbaldri...@gmail.com>wrote:
>>
>>> 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 <pbaldu...@gmail.com>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 clojure@googlegroups.com
>>>> Note that posts from new members are moderated - please be patient with
>>>> your first post.
>>>> To unsubscribe from this group, send email to
>>>> clojure+unsubscr...@googlegroups.com
>>>> 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 clojure+unsubscr...@googlegroups.com.
>>>> 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 clojure@googlegroups.com
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> clojure+unsubscr...@googlegroups.com
>>> 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 clojure+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> 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 clojure+unsubscr...@googlegroups.com.
>> 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 clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to