Re: update in place for unique references

2009-01-09 Thread Mark P
Hi Stuart, > I think the big strength of Clojure is how easy it is to integrate > Java code. If you have some performance-critical code you can always > drop down to Java. Certainly, performance is important to Clojure, but > I think the assumption is that it will never compete with pure Java on

Re: update in place for unique references

2009-01-09 Thread Mark P
Hi Tim, I appreciate your comments. > It is possible to achieve this behavior explicitly if you really > wanted to: > (defn create-add-2 [] >   (with-local-vars [x 1] >     (do >       (var-set x 1) >       (var-set x (inc @x)) >       (let [z @x] >         (fn [y] (+ y z)) That's true. On

Re: update in place for unique references

2009-01-09 Thread Stuart Sierra
On Jan 8, 10:45 pm, Mark P wrote: > I should also clarify one point.  I am not "asking for this language > feature" so much as "asking whether people have thought > about it".  There may (or may not) be good reasons for not offering > such a language feature.  I'm just wondering if it has been >

Re: update in place for unique references

2009-01-09 Thread Timothy Pratley
> Most structures of this type would start life as a uniquely-referenced > structure (either empty or a copy of an immutable), and have > lots of mutations effectively applied to them in a safe environment, > until they are ready to be "frozen" and released to the world as > an immutable version o

Re: update in place for unique references

2009-01-08 Thread Mark P
Hi Mark F, Thanks for your responses. > 1. Data: Is this really a problem that is slowing down Clojure > programs in practice? Can you provide some data to that effect? I > would suggest writing a couple of Java benchmarks - one that updates a > simple structure in place and one that only create

Re: update in place for unique references

2009-01-08 Thread Mark Fredrickson
Time for another person named Mark to chime in. I expect to hear from all the other Marks before this thread is over. I have three responses to your suggestion: 1. Data: Is this really a problem that is slowing down Clojure programs in practice? Can you provide some data to that effect? I

Re: update in place for unique references

2009-01-08 Thread Mark P
> Clojure gives you a set of data structures that do very fast > non-destructive update.  Clojure also gives you tools like atoms, > refs, and full access to Java's mutable behavior to specify update in > place if that's what you want. Yes, I can see that one could implement this oneself via Java

Re: update in place for unique references

2009-01-08 Thread Mark Engelberg
Clean doesn't allow mutation, so it has to do tricks like this or else you'd never be able to write a useful program. Clojure gives you a set of data structures that do very fast non-destructive update. Clojure also gives you tools like atoms, refs, and full access to Java's mutable behavior to