Yes, I agree using loop/recur is preferable for many reasons when possible.
On Jul 9, 8:37 pm, Daniel Lyons <fus...@storytotell.org> wrote: > 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 an Atom, but I was wondering if > > there's a more low-level way (besides using the java interop, since I > > may still want this variable to be dynamically typed.) > > I think if you're potentially depending on reflection, being concerned > about the "right kind" of mutable variable might be a little > misguided. Probably better to use recur and pass the new value to the > next iteration of the loop instead, if there's any way you can do > that. Keep it local instead of mutable. > > — > Daniel Lyons --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---