Re: Clojure equivalent of special common lisp vars: still looking for that zen place...

2014-05-05 Thread Gary Trakhman
Sometimes you do want a mutable thing with thread-local binding, noir does this for it's mutable session-flash stuff: https://github.com/noir-clojure/lib-noir/blob/master/src/noir/session.clj#L95 I don't really recommend the approach, but I could see it being convenient. On Mon, May 5, 2014 at 1

Re: Clojure equivalent of special common lisp vars: still looking for that zen place...

2014-05-05 Thread John Gabriele
On Saturday, May 3, 2014 10:53:40 AM UTC-4, Bob Hutchison wrote: > > > On May 3, 2014, at 9:45 AM, Dave Tenny > > wrote: > > I'm still struggling with how to write the most readable, simple clojure > code > to deal with dynamically bindings. > > What is the graceful clojure equivalent of common l

Re: Clojure equivalent of special common lisp vars: still looking for that zen place...

2014-05-03 Thread Dave Tenny
re: binding behavior, I've only been using clojure since 1.5.1, but in my travels I get the impression that the binding form didn't always enforce the variable to be declared dynamic, and so maybe didn't behave the way you'd expect if the ^:dynamic was missing from the target of the binding form.

Re: Clojure equivalent of special common lisp vars: still looking for that zen place...

2014-05-03 Thread Dave Tenny
On Sat, May 3, 2014 at 10:53 AM, Bob Hutchison wrote: > You can also just use ‘def’ to redefine the global binding. Thanks, though in this case it's a mixed use. In some cases I want to change the root of the global binding, in others I want to rebind to a new value in some context without cha

Re: Clojure equivalent of special common lisp vars: still looking for that zen place...

2014-05-03 Thread Lee Spector
On May 3, 2014, at 9:45 AM, Dave Tenny wrote: > > The way I'm tempted to do this in clojure is > > (def ^{:dynamic true} *x* (atom 1)) > ... do stuff with @*x* ... > (reset! *x* 2) > ... do stuff with @*x* ... > (binding [*x* (atom 3)] (do stuff with @*x*)) Having also come from Common Lisp a

Re: Clojure equivalent of special common lisp vars: still looking for that zen place...

2014-05-03 Thread Bob Hutchison
On May 3, 2014, at 9:45 AM, Dave Tenny wrote: > I'm still struggling with how to write the most readable, simple clojure code > to deal with dynamically bindings. > > What is the graceful clojure equivalent of common lisp special variables for > the following scenario. > > If I were writing c