this is how you do it:

user=> (def a 0)
#'user/a
user=> (binding [a 1] (map #(+ % a) (range 5)))
(0 1 2 3 4)
user=> (binding [a 1] (let [a a] (map #(+ a %) (range 5))))
(1 2 3 4 5)
user=>

you capture the dynamic scope in the lexical scope so the closure can
close over it.

dunno how applicable this is to more complex uses of binding

On Tue, Jul 14, 2009 at 6:09 PM, Mark Engelberg<mark.engelb...@gmail.com> wrote:
>
> It almost seems like what you want is for lazy data structures to
> close over the dynamic vars that have been modified from their root
> bindings at the time the lazy data structure is created.  Seems like
> coming up with well-defined semantics for this would be an interesting
> research problem, and if done properly, could end up matching people's
> intuition and being a lot more useful than the current awkwardness of
> the way that vars and laziness interact.
>
> >
>



-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

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

Reply via email to