Using your example--very helpful, BTW--I simplified it a bit more:
user=> (def x 10)
#'user/x
user=> (def y #'x)
#'user/y
user=> y
#'user/x
user=> @y
10
user=> (def x (fn [me] (println "Welcome" me)))
#'user/x
user=> (y "hello")
Welcome hello
nil
user=> (@y "yikes")
Welcome yikes
nil
What I come
In this case the var is simply acting as a mutable pointer, so that
when the implementation is changed the route reflects the new value.
Here's a simple example of that behavior in action, divorced from
webservers and the like:
;; caller accepts a function and returns a new one that forwards to it
I've been working with Compojure and Ring lately to build an app
server, and I've gotten my brain stuck trying to figure out wrap-
reload. It seems like I have to turn my routes into vars to get wrap-
reload to work, but I don't understand why, and I suppose I don't
really understand the "when" or
On Tue, Jan 27, 2009 at 10:05 AM, Brian Doyle wrote:
>
> On Tue, Jan 27, 2009 at 7:43 AM, Chouser wrote:
>>
>> user=> (def expr (read (java.io.PushbackReader. (java.io.StringReader.
>> "(+ 1 2)"
>> user=> (first expr)
>> +
>> user=> (namespace (first expr))
>> nil
>
> This nil namespace seem
On Tue, Jan 27, 2009 at 7:43 AM, Chouser wrote:
>
> On Tue, Jan 27, 2009 at 8:51 AM, Mark Volkmann
> wrote:
> >
> > Are these statements correct? Actually, I know some are correct
> > because I just looked though the source. Hopefully others that haven't
> > will find this interesting.
> >
> > S
On Tue, Jan 27, 2009 at 8:51 AM, Mark Volkmann
wrote:
>
> Are these statements correct? Actually, I know some are correct
> because I just looked though the source. Hopefully others that haven't
> will find this interesting.
>
> Symbol objects have a String name and a String namespace name, but n
Are these statements correct? Actually, I know some are correct
because I just looked though the source. Hopefully others that haven't
will find this interesting.
Symbol objects have a String name and a String namespace name, but no value.
Var objects have references to a Symbol object, a Namespa