Ahh, for some reason, I had the impression that it can be used as mutable 
object. Just reread the "transient data structure" page, realize that I've 
been knowing it wrong all this time. 

Thanks

On Tuesday, November 10, 2015 at 1:11:56 PM UTC-6, Alex Miller wrote:
>
> That is, you should use the exact same modification pattern that you use 
> with persistent collections.
>
> On Tuesday, November 10, 2015 at 1:05:38 PM UTC-6, Laurens Van Houtven 
> wrote:
>>
>> Hi Ritchie
>>
>>
>> You appear to be using the transient as a mutable object, which is not 
>> correct in the general case. You should only use the return value of 
>> assoc!/dissoc!/et cetera.
>>
>>
>> lvh
>>
>> On Nov 10, 2015, at 1:03 PM, Ritchie Cai <ritch...@gmail.com 
>> <javascript:>> wrote:
>>
>> btw, I'm using Java 1.8.0_60-b27, Clojure 1.7.0
>>
>> On Tuesday, November 10, 2015 at 12:59:54 PM UTC-6, Ritchie Cai wrote:
>>>
>>> Hi,
>>>
>>> I'm wondering if anyone can help me understand why transient map in my 
>>> code stops adding entries. 
>>> Here is my implementation of huffman code generation given a string: 
>>>
>>>
>>> https://gist.github.com/malloc82/efeec1053b9af195e351#file-huffman-clj-L53-L55
>>>
>>> Line 53-55 is where it adds a huffman code entry into a transient map. 
>>> If you run the test on line 61, you can see from print out and return value 
>>> that no new entry is added after adding 8 entries, i.e. after \A. No sure 
>>> why.
>>>
>>> Thanks
>>> Ritchie
>>>
>>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> <javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to