On Mon, Mar 14, 2005 at 09:52:06AM -0700, Luke Palmer wrote:
: Perhaps lists by assignment are COW lazy.  So they behave just like
: ordinary COW objects, except they can be lazy at the end:
: 
:     my @a = gather {
:                 for 1... {
:                     say;
:                     take;
:                 }
:             };
:     @a[10];  # says 1 2 3 ... 10
:     @a[5] = 42;
:     @a[20];  # nothing printed
: 
: I wonder if that's DingTRT though...

My feeling is that it prints

    11 12 13 14 15 16 17 18 19 20

and then if you say [EMAIL PROTECTED] you'll get:

    1 2 3 4 5 42 7 8 9 10 11 12 13 14 15 16 17 18 19 20

That is, once a value is generated, it's just an ordinary array value.
The generator is just attached at the end, and doesn't care what you
do with existing values.

On the other hand, maybe you have to use "my @a :="  if we make = eager.

Larry

Reply via email to