Re: ref to array suddenly changes type

2012-09-21 Thread Piotr Gorak
Andy & Jim - thank you! This explains the whole thing perfectly. Piotr -- 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

Re: ref to array suddenly changes type

2012-09-21 Thread Jim - FooBar();
As Andy indicated, it is almost never a good idea to wrap something mutable in a reference type simply because the guarantees of references do not hold for mutable things. In other words, the thing the ref points to can be changed without going through the ref which defeats the whole purpose of

Re: ref to array suddenly changes type

2012-09-20 Thread Andy Fingerhut
Piotr: The most direct answer to your specific question is that aset-int modifies the array, and returns the value 9. The return value 9 is what the ref r is being set to after the (dosync (alter ...)) call. However, there is a bigger issue here. Even if you replace aset-int with a different