Re: Best way to create nonref variable?

2009-07-10 Thread Laurent PETIT
If you don't want the overhead introduced by an atom or (maybe, I'm not sure) by local vars, you can just instanciate a mutable object. The simplest being just an array of Objects with just one element. This can be achieved without java interop by using make-array , aset, aget ... A lasst

Re: Best way to create nonref variable?

2009-07-10 Thread John Harrop
On Thu, Jul 9, 2009 at 10:29 PM, J. McConnell jdo...@gmail.com wrote: You can try with-local-vars. I'm not sure of the performance characteristics of this versus using an atom, but it certainly feels more imperative: It's slow. I suspect it (and binding) uses Java's ThreadLocal, which is

Best way to create nonref variable?

2009-07-09 Thread Conrad
Hi everyone: I'm trying to optimize an inner loop and need a variable that mutates to make this work. It does NOT need to be a thread-safe variable. What's the best way to create a plain ol' mutating variable in Clojure? I know I can always use an Atom, but I was wondering if there's a more

Re: Best way to create nonref variable?

2009-07-09 Thread Conrad
I suspect the answer will be that I should use atoms (despite the fact that it isn't completely low level) since I see RH uses those in his memoization example, which is pretty much the epitemy of optimizing with a mutating local variable. :-) On Jul 9, 7:56 pm, Conrad drc...@gmail.com wrote:

Re: Best way to create nonref variable?

2009-07-09 Thread Daniel Lyons
On Jul 9, 2009, at 5:56 PM, Conrad wrote: Hi everyone: I'm trying to optimize an inner loop and need a variable that mutates to make this work. It does NOT need to be a thread-safe variable. What's the best way to create a plain ol' mutating variable in Clojure? I know I can always use

Re: Best way to create nonref variable?

2009-07-09 Thread J. McConnell
On Thu, Jul 9, 2009 at 7:56 PM, Conraddrc...@gmail.com wrote: I'm trying to optimize an inner loop and need a variable that mutates to make this work. It does NOT need to be a thread-safe variable. What's the best way to create a plain ol' mutating variable in Clojure? I know I can always