yary not.com-at-gmail.com |Perl 6| wrote:

Though I'm not quite sure that S03 covers some of the different-dimension cases.
my @table=
 (1,2,3;
  4,5,6); # is this the syntax to create 2d array?
No, the Capture on the right, although a Capture of Captures, will be flattened in the list context provided by list assignment.

   my @table= [1,2,3],[4,5,6];

will give you a Perl5-like array containing arrays for elements.

To give a true multi-dimensional array, you must declare it. Although the lengths don't have to be fixed, you at least need the number of dimensions (which could involve ** so the dimensionality could be variable).

   my @table[2;3];

I pondered over feeding it another list of items in my APL essay. I figured an iterator over the 2-D array should visit the elements in order. So, use that to "reshape" the simple list.

--John


Reply via email to