User defined autovivification

2005-08-28 Thread Yuval Kogman
Today I wrote some perl 5 code that looked like this: my %index_by_x; my %index_by_y; my %index_by_z; foreach my $thing (@things){ ( $index_by_x{$thing-x_value} ||= Set::Object-new)-insert($thing); ( $index_by_y{$thing-y_value} ||=

Re: User defined autovivification

2005-08-28 Thread Yuval Kogman
On Sun, Aug 28, 2005 at 05:56:58 -0400, David Storrs wrote: While I think your P6 code is great, I don't feel you're comparing apples to apples. In all your P6 examples you effectively break the autovivify step out from the other steps. You can do that in P5 too: To me the code below