On Sep 30, 9:07 pm, Chouser <[EMAIL PROTECTED]> wrote: > On Tue, Sep 30, 2008 at 7:24 PM, dherring <[EMAIL PROTECTED]> wrote: > > > Related question: Is there any way to "return" side-channel data past > > intermediate frames which don't understand the protocol (i.e. no > > throwing an exception and prematurely terminating them)? > > I don't know if this is sufficient for what you had in mind, but it's > pretty close:
I was looking for something more functional, something without explicit side effects. But maybe its just a figment of my not sleeping last night (crazy deadline at work). Looking at the website, I now read "Bindings created with binding can be assigned to, which provides a means for nested contexts to communicate with code before it the call stack." So this last question may have been wack. But here's a follow on: How can I, without introducing temporary variables, pass a bound variable back up to the parent binding? e.g. (binding [x nil y nil] (binding [x 1 y 1] ; how to set the upper "x" to 1 or 2 or ... )) or fleshed out as (defn knows-protocol [x] (set! side-x x) (+ x 5)) (defn filter-protocol [fn x] (binding [side-x nil side-y nil] ; capture the protocol so we can selectively modify side-x and block side-y (fn x) (when (something side-x) (set! side-x (+ 2 x))))) ; should modify the previous binding (defn test [] (binding [side-x nil side-y nil] (filter-protocol knows-protocol 5) ; I want side-x to be 7 )) I guess filter-protocol would be written as (defn filter-protocol [fn x] (let [local-x side-x] (binding [side-y nil] (fn x)) (if (something side-x) (set! side-x (+ 2 x)) (set! side-x local-x)))) but this feels dirty. Clojure's a new tool for me, and I'm kicking the tires trying to figure out how it works. Thanks, Daniel --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---