Re: Bug in count for hash-maps with nil values

2009-09-25 Thread Christophe Grand
On Fri, Sep 25, 2009 at 1:46 AM, Richard Newman holyg...@gmail.com wrote:


  I guess this is already ticketed.  I should have searched first, sorry
  for the noise.

 It's not already ticketed, even if the root cause might be the same.
 As I pointed out in my message, these are not hash maps, they're array
 maps.


It's the same root cause, and it has to do with hash maps.
When the 9-item hash map is built the bug causes its count to drop to zero
(but calling seq on it reveal there are 9 key-value pairs in it).
But, the compiler optimizes literal maps whose count is zero into the empty
array map.

So, really, it's not a bug in PersistentArrayMap and the patch against
PersistentHashMap attached to #192 fixes this behaviour.

I'm sorry to have introduced this bug.

Christophe

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Bug in count for hash-maps with nil values

2009-09-24 Thread Richard Newman

 Can anyone else confirm?

I see the same thing. Both working and non-working lengths are  
PersistentArrayMaps, so this isn't a hash map thing.

user= (type {1 nil 2 nil 3 nil 4 nil 5 nil 6 nil 7 nil 8 nil 9 nil})
clojure.lang.PersistentArrayMap
user= (type {1 nil 2 nil 3 nil 4 nil 5 nil 6 nil 7 nil 8 nil})
clojure.lang.PersistentArrayMap

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Bug in count for hash-maps with nil values

2009-09-24 Thread MarkSwanson

Confirmed. I'm using clojure from git:
$ git status
# On branch master
nothing to commit (working directory clean)

I also tried with the ':'

Clojure= (count {:1 nil :2 nil :3 nil :4 nil :5 nil :6 nil :7 nil :8
nil :9 nil})
0


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Bug in count for hash-maps with nil values

2009-09-24 Thread Jason Wolfe

I guess this is already ticketed.  I should have searched first, sorry
for the noise.

http://www.assembla.com/spaces/clojure/tickets/192-hashmaps--count-is-not-always-updated-when-associng-dissocing-a-nil-key

-Jason
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Bug in count for hash-maps with nil values

2009-09-24 Thread Richard Newman

 I guess this is already ticketed.  I should have searched first, sorry
 for the noise.

It's not already ticketed, even if the root cause might be the same.
As I pointed out in my message, these are not hash maps, they're array
maps.

You should file a new ticket and refer to #192.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---