On Tue, Feb 17, 2009 at 11:48 PM, David Sletten <da...@bosatsu.net> wrote:
>
> ; Clojure. We can access the reference itself via "var".
> (def pung 8)
> (def foo pung) ; i.e., (deref (var pung)) or @#'pung
> (def bar (var pung))
>
> ; "binding" changes value of "pung"--apparently not the variable
> itself, thus
> ; "bar" also reflects changed value.
> (binding [pung 9] (list pung foo @bar)) => (9 8 9)
>
> ; By contrast "let" binds "pung" to a new variable, which shadows the
> global.
> ; "bar" still refers to global "pung"
> (let [pung 9] (list pung foo @bar)) => (9 8 8)
>
> Do I have it right now?

The code and comments look right to me, but I'm not sure where that
leaves us on the original question of terminology.

I could say that the var named pung (user/pung, to be specific) has
the root value 8, but was there anything "bound" there?  And I can't
deny that pung becomes bound to 9 since a macro named 'binding' was
used.  Does that imply that the var was bound to 8 earlier?  Was the
name 'pung' bound to the Var?

Everything seems to have stopped making sense.  Perhaps I shouldn't
try to post this late at night.

--Chouser

--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to