From: "John Tromp" <tromp / serpens.ins.cwi.nl>
> [all code snipped]
> but unfortunately, the default value [] for the Hash is shared by all
> elements, rather than copied, as I expected.
>
> I was wondering if this was a conscious design decision, or an oversight.
> I finally ended up with the much uglier
>
> Is there another way to avoid the explicit tests?


It's a common problem (are you listening, Bill :).

I don't know about the design decision, but can offer a nicer solution.  Others
will undoubtably have others; I remember there being some clever ones expressed
in the past, but not what they are :(

Anyway:

  (hash[key] ||= []) << value

Make sense?

Gavin