Re: RFC 177 (v1) A Natural Syntax Extension For Chained References

2000-08-31 Thread Jeremy Howard

Buddha Buck wrote:
> At 05:35 PM 8/31/00 +, David L. Nicol wrote:
> >Buddha Buck wrote:
> > > > The array
> > > > syntax would also be useful in multi-dimensional arrays.
> > >
> > > That is if multi-dimensional arrays are implemented as lists-of-lists,
> > > which they might not be.
> >
> >Even if they aren't implemented as lol, they may appear as lol to the
> >programmer
>
> The language-data group is working on multi-dimensional array syntax.
>
> I would like to have (in multidimensional arrays) the various dimensions
be
> equally easy to access.  Using lol syntax imposes a hierarchy on the
> dimensions, which makes equal access hard.
>
Not necessarily. _Allowing_ LOL syntax does *not* rule out provides other
syntax which allows direct access to slices of additional dimensions.
Providing both approaches means that all the language constructs and modules
that already support LOLs will continue to work, while n-dim access works as
well. It also avoids creating a new data type.

Anyhow, let's keep this discussion to -data from here... RFC 177 should
probably make -data its home.





Re: RFC 177 (v1) A Natural Syntax Extension For Chained References

2000-08-31 Thread Buddha Buck

At 05:35 PM 8/31/00 +, David L. Nicol wrote:
>Buddha Buck wrote:
> > > The array
> > > syntax would also be useful in multi-dimensional arrays.
> >
> > That is if multi-dimensional arrays are implemented as lists-of-lists,
> > which they might not be.
>
>Even if they aren't implemented as lol, they may appear as lol to the 
>programmer

The language-data group is working on multi-dimensional array syntax.

I would like to have (in multidimensional arrays) the various dimensions be 
equally easy to access.  Using lol syntax imposes a hierarchy on the 
dimensions, which makes equal access hard.

For instance, using the syntax I proposed in RFC169, you can take the $ith 
row and $jth column of a 2-dimensional array with:

@row = @matrix[$i;..];
@col = @matrix[..;$j];

This can be naturally extended to greater dimensions, if need be.

How does one do this in LOL syntax?

@row = @{$matrix[$i]};  # this is easy!
for my $r (@matrix) {
   push @col,$$row[$j];
}   # this is easy?

I suppose one could do:

for (my $k = 0;$k < @matrix; $k++) {
push @row, $matrix[$i][$k];
push @col, $matrix[$k][$j];
}

but even that obscures what you really want to do.



>--
>   David Nicol 816.235.1187 [EMAIL PROTECTED]
>"My baby done left me,
>she done went to the drive-in movies with somebody else."