At 7:28 PM -0700 3/28/07, [EMAIL PROTECTED] wrote:
=head1 Multidimensional arrays
+Perl 6 arrays are not restricted to being one-dimensional (that's simply
+the default). To declare a multidimensional array, you specify it with a
+semicolon-separated list of dimension lengths:
+
+ my int @ints[4;2]; # Valid indices are 0..3 ; 0..1
+
+ my @calendar[12;31;24]; # Valid indices are 0..11 ; 0..30 ; 0..23
+
+You can pass a multislice for the shape as well:
+
+ @@shape = (4;2);
+ my int @ints[ [;[EMAIL PROTECTED] ];
+ my int @ints[@@shape]; # Same thing
<snip>
This is great and all, but ...
How would one declare an anonymous multidimensional array value that
is compatible with this system?
Eg, with normal arrays, one can say [foo,bar,baz] to declare a normal
anonymous array value with those 3 elements.
But say for example that one wants to do a matrix multiply of literal
values, and so each operand is a 2x3 array, and so is the result ...
could we do something like this:
my $result = [4,5;6,7;8,9] * [7,0;44,4;5,3];
Or that's probably bad syntax or example, but you get the idea; one
defined an entire multi-dim-array value inline and not with a bunch
of element assignments.
I didn't see this matter addressed in Synopsis 9.
Or do you consider this unlikely, and that people who use
multidimensional arrays or hashes would be more likely to build their
values piecemeal, or use "arrays of arrays", which afaik are not the
same thing?
-- Darren Duncan