On Mon, Aug 28, 2000 at 04:04:20PM -0400, John Porter wrote:
> Well, I think it's likely that the perl6 parser would be made to
> handle this; but even if not, it shouldn't be too hard to get it
> to allow a ref to such a list:
> 
>       for [ $x, $y, $z ] ( @list ) { ...

I'm wondering how we get both

        for ($x,$y,$z) (@array) { ... }

and

        for ($x,$y,$z) (@array1,@array2,@array3) { ... }

The answer seems to be to use either C<unzip()> or C<partition()>, but
we still need that syntax where we have multiple iterators.  Unless
we really want to write this:

        for $threes (partition(3, \@list)) { 
           ($x, $y, $z) = @{$threes};
        }
        for (partition(3, \@list)) { ($x, $y, $z) = @{$_};

The square bracket syntax is alluring since it implies referenceness,
but it goes the wrong way; squares enreference rather than dereference.

Random thoughts:

        for @{$x,$y,$z} (partition(3, \@list)) { ... }
        for ($x,$y,$z) = @{$_} (partition(3, \@list)) { ... }
        for ($x,$y,$z) (@{partition(3, \@list)}) { ... }
        for @three (@{partition(3, \@list)}) { ... }            # arrays only
        for @three (@{partition(3, \@list)}) @indices { ... }   # arrays only

Ick.  

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to