> Not being a PDL'er myself, but interested in learning more about it and
> making sure Perl 6 doesn't suck, I'd love to see a bulleted list of what
> doesn't work right, even assuming that @arrays were made more flexible.
> For example, if you could do this:
> 
>    @c = @a * @b;
>    @c = @a + @b;
>    @c = (@a - @b) * (@d / @e);
> 
> What other specific problems remain? TIA.

I'm not a PDL'er myself, either.  But I haven't noticed a syntax 
suggested for multidimensional arrays that looks good to me yet.

How are they indexed?  $matrix[$x][$y][$z] is (too me) too C'ish, and 
implies that @matrix is implemented as an array of arrays of arrays, 
instead of some more efficient, compact structure.  $matrix[$x,$y,$z] 
already has a reasonable meaning.  If we appropriate that syntax, how 
do you take slices of a matrix?

I'm thinking I like using ; as an index separator, as in 
$matrix[$x;$y;$z].  This -shouldn't- be a massive problem for parsing; 
we are already using ; in "for(;;)" as something other than a statement 
separator.

This would also allow us to do slices like: @matrix[1,3,5;2,4,6;3] to 
get a 3x3x1 resulting matrix consisting of $matrix[1;2;3],$matrix[1;4;3]
, etc.

How are literal multidimensional arrays written?  For this, I'm not 
sure...  My first thought was to separate the rows with ;, as in 
@matrix = ( 1,2;3,4).  But that doesn't scale well to more than 2d.  
Then I thought just using the standard list of list syntax:  @matrix = 
( [1,2],[3,4] ).  But is that a list of array references, or a 2-d 
array?  Next, I thought of combining the two:

@matrix3x3x3 = ( [[ 1, 2, 3];
                  [ 4, 5, 6];
                  [ 7, 8, 9]];   # row 0;
                 [[10,11,12];  
                  [13,14,15];
                  [16,17,18]];   # row 1;
                 [[19,20,21];
                  [22,23,24];
                  [25,26,27]] ); # row 2;

I think parenthesis might be better, using [] for reference 
constructors, but any way you look at it.

Should explicit bounds and declarations take place before use?  Is "my 
@matrix:bounds(3,3,3);" necessary?  I don't know about you, but 
autovivication of array elements and boundlessness is a feature I like 
about perl.  Why should "$array[1000] = $x" work without predeclaration 
but "$matrix[1000;1000;1000] = $x" shouldn't?

Just my thoughts?


 
> 
> -Nate

-- 
     Buddha Buck                             [EMAIL PROTECTED]
"Just as the strength of the Internet is chaos, so the strength of our
liberty depends upon the chaos and cacophony of the unfettered speech
the First Amendment protects."  -- A.L.A. v. U.S. Dept. of Justice


Reply via email to