Re: Understanding clojure bindings

2010-11-27 Thread Alex Osborne
Andreas Kostler writes: > Is this a 'bug' with eval? No, eval is a simply a function and so like any other function it can't "see" the lexical (local) environment which it was called from. Doing this: (let [a 1, b 2] (eval '(+ a b))) Is similar to doing this: (defn cake [] (+ a

Re: Understanding clojure bindings

2010-11-27 Thread Tim Robinson
This works as I would expect it to. 'rule' brings in 'state' from the global binding into it's scope giving it priority over the outer scope bindings found in the parent function. On Nov 27, 9:15 pm, Andreas Kostler wrote: > Is this a 'bug' with eval? > > On 28 November 2010 14:09, Ken Wesson w

Re: Understanding clojure bindings

2010-11-27 Thread Ken Wesson
On Sat, Nov 27, 2010 at 11:15 PM, Andreas Kostler wrote: > Is this a 'bug' with eval? It seems to be intended, if undocumented* and sometimes awkward, behavior. * In that (doc eval) doesn't say anything about this issue. -- You received this message because you are subscribed to the Google Gro

Re: Understanding clojure bindings

2010-11-27 Thread Andreas Kostler
Is this a 'bug' with eval? On 28 November 2010 14:09, Ken Wesson wrote: > On Sat, Nov 27, 2010 at 10:42 PM, Andreas Kostler > wrote: > > Hi all, > > Sorry for my noob question (again). I'm trying to understand clojures > > binding model. > > Typing: > > (def state {:status "foo"}) > > (def rule

Re: Understanding clojure bindings

2010-11-27 Thread Ken Wesson
On Sat, Nov 27, 2010 at 10:42 PM, Andreas Kostler wrote: > Hi all, > Sorry for my noob question (again). I'm trying to understand clojures > binding model. > Typing: > (def state {:status "foo"}) > (def rule '(if (= (:status sate) "foo") (println "foo") (println > ("bar"))) > > (defn fn [] >  (let

Re: Understanding clojure bindings

2010-11-27 Thread Eduardo Julian
You might wanna check out the post I recently made and the answer by Ken Wesson: http://groups.google.com/group/clojure/browse_thread/thread/9b042a2ddb8017aa It's basically the same thing. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to th