On Wed, Feb 4, 2009 at 8:48 PM, Jes Gabriel y Gal
<jgabrielygalan / gmail.com> wrote:
>> Here is your problem. Hash.new(0) means "when I query the hash, and
>> the key I request is not in there, return 0". It does not actually add
>> {key => 0} to the hash itself.
>
> This is true, but counts[d] += 1 is actually counts[d] = counts[d] + 1
> so the RHS will evaluate to 1 the first time, assigning it to the hash:

Oops - yes, missed that.

martin