You can take a look at the IFn, AFn & Fn files in the clojure.lang package to get a better understanding of what is going on.
Sean On Feb 4, 8:33 am, Ludovic Kuty <ludovic.k...@gmail.com> wrote: > Hello, > > I was wondering if symbol resolution in local scope (in a let or > function body) works the same way as it is in Scheme. I would like to > know some internals of Clojure when it comes to that. I thought about > explaining how closures work to my students using that analogy (is it > just an analogy ?), which I find to be an particularly clear way to > proceed but I want to avoid talking specifically about Scheme when I > want to talk about Clojure. Unless both are the same with respect to > this matter. > > In Scheme, when a function is defined, a closure is created and is > composed of code (the body of the function) and an environment which > captures needed lexical bindings. When the closure is called (applied > to arguments), a new lexical environment is created to contain the > bindings of the arguments and that new environment is linked to the > one used in the definition of the function (points to). So, if we use > a variable in the body of the function, we look first in the new > environment and then in the other environment. > > There could be a chaining of lexical environments. > > There is an elegant notation to describe that process called > "Weizenbaum notation" but I was not able to find any source on it on > the Web. I used that when I studied Scheme in school, back in 97. If > anynone has got information on it, I would be glad. I guess it is > related to Joseph Weizenbaum. > We had, a control environment, an access environment, a form to be > evaluated and bindings in the current environment (terms translated > from french as the course was given in french). All in a concise > Weizenbaum frame. > > Does it work the same in Clojure ? Or maybe someone could point me to > the source file ou source files where I can find that information. > > TIA, > > Ludovic Kuty -- 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