Re: dimensions in a multidimensional array

2021-02-06 Thread Theo van den Heuvel
multidimensional array, other than by looking at the size of the first row and column, with @m[0;*].elems and @m[*;0].elems. Am I missing something in the docs? If it's a shaped multidimensional array, you can call the .shape method my @a[3;3;3]; dd @a.shape; # (3,3,3) If it i

Re: dimensions in a multidimensional array

2021-02-05 Thread Matthew Stuckwisch
t;> > On 5 Feb 2021, at 15:49, Theo van den Heuvel wrote: >> > I cannot seem to find an idiomatic way to get the dimensions of a >> > multidimensional array, >> > other than by looking at the size of the first row and column, with >> > @m[0;*].elems and @m[*;0].elems. >

Re: dimensions in a multidimensional array

2021-02-05 Thread Wesley Peng
When will we have p6’s Numpy? On Sat, Feb 6, 2021, at 2:04 AM, Brad Gilbert wrote: > There is a reason that you can't just ask for the dimensions of an > unspecified multidimensional array. > It may be multiple dimensions. > > [[1,2,3], > [4,5,6,7,8,9,10]].

Re: dimensions in a multidimensional array

2021-02-05 Thread Brad Gilbert
There is a reason that you can't just ask for the dimensions of an unspecified multidimensional array. It may be multiple dimensions. [[1,2,3], [4,5,6,7,8,9,10]].shape If it gave a result it would be something like: (2,3|7) On Fri, Feb 5, 2021 at 8:50 AM Theo van den Heuvel

Re: dimensions in a multidimensional array

2021-02-05 Thread Timo Paulssen
t;> wrote: > I cannot seem to find an idiomatic way to get the dimensions of a multidimensional array, > other than by looking at the size of the first row and column, with @m[0;*].elems and @m[*;0].elems. > Am I missing something in the docs? If it's a shaped

Re: dimensions in a multidimensional array

2021-02-05 Thread yary
o list -y On Fri, Feb 5, 2021 at 10:06 AM Elizabeth Mattijsen wrote: > > On 5 Feb 2021, at 15:49, Theo van den Heuvel > wrote: > > I cannot seem to find an idiomatic way to get the dimensions of a > multidimensional array, > > other than by looking at the size of the

Re: dimensions in a multidimensional array

2021-02-05 Thread Elizabeth Mattijsen
> On 5 Feb 2021, at 15:49, Theo van den Heuvel wrote: > I cannot seem to find an idiomatic way to get the dimensions of a > multidimensional array, > other than by looking at the size of the first row and column, with > @m[0;*].elems and @m[*;0].elems. > Am I missing somethin

dimensions in a multidimensional array

2021-02-05 Thread Theo van den Heuvel
Hi gurus, I cannot seem to find an idiomatic way to get the dimensions of a multidimensional array, other than by looking at the size of the first row and column, with @m[0;*].elems and @m[*;0].elems. Am I missing something in the docs? Thanks, -- Theo van den Heuvel

[perl #128341] [JVM] RuntimeException when calling .perl on multidimensional array with some elements autovivified

2016-11-13 Thread Christian Bartolomaeus via RT
Fixed with https://github.com/rakudo/rakudo/commit/13f6b63455 I'm closing this ticket as 'resolved'.

[perl #128341] [JVM] RuntimeException when calling .perl on multidimensional array with some elements autovivified

2016-06-07 Thread Christian Bartolomaeus via RT
As a follow-up: The following code works as expected: $ perl6-j -e 'my @a; @a[0;1] = "foo"; @a[0;0] = "bar"; say @a.perl' [["bar", "foo"],]

[perl #128341] [JVM] RuntimeException when calling .perl on multidimensional array with only some elements autovivified

2016-06-07 Thread via RT
# New Ticket Created by Christian Bartolomaeus # Please include the string: [perl #128341] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=128341 > The following code started to fail on rakudo-j with Rakudo commit 069b789af5:

[perl #126979] Infinite loop when defining a multidimensional array without given dimensions REPL.

2015-12-21 Thread via RT
# New Ticket Created by # Please include the string: [perl #126979] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=126979 > Hi This statement causes an infinite loop in REPL my @a[;]; This is Rakudo version 2015.11-

Re: Anonymous multidimensional array

2009-06-02 Thread John M. Dlugosz
Larry Wall larry-at-wall.org |Perl 6| wrote: On Tue, Jun 02, 2009 at 08:21:29AM -0700, yary wrote: : I do see a problem if there's more than one unspecified dimension. : Though I suppose an array of shape(*;*) as an lvalue might be a : constraint allowing assignment only of another 2D array? I d

Re: Anonymous multidimensional array

2009-06-02 Thread yary
I haven't gotten deep into the shape/array specs and I need to... nonetheless On Tue, Jun 2, 2009 at 9:55 AM, Larry Wall wrote: > I don't see why we shouldn't use the capture shape of the value > by default all the time, and do linear reshaping only if the value > comes in as a flat list. This h

Re: Anonymous multidimensional array

2009-06-02 Thread Larry Wall
On Tue, Jun 02, 2009 at 08:21:29AM -0700, yary wrote: : I do see a problem if there's more than one unspecified dimension. : Though I suppose an array of shape(*;*) as an lvalue might be a : constraint allowing assignment only of another 2D array? I don't see why we shouldn't use the capture shape

Re: Anonymous multidimensional array

2009-06-02 Thread yary
On Mon, Jun 1, 2009 at 10:43 PM, John M. Dlugosz > And it should be an error if dimensions other than the highest are > unspecified.  How can it know how to shape it?  Use an explicit command to > shape up the argument in that case. I don't see why shape(2;*) is not a problem and shape(*;2) is a p

Re: Anonymous multidimensional array

2009-06-01 Thread John M. Dlugosz
Larry Wall larry-at-wall.org |Perl 6| wrote: On Mon, Jun 01, 2009 at 08:23:41PM -0700, yary wrote: : How does one create an anonymous multidimensional array in p6? Not an : array of arrays or a capture of captures... But I would expect a shaped array to be able to coerce either of those into

Re: Anonymous multidimensional array

2009-06-01 Thread Larry Wall
On Mon, Jun 01, 2009 at 08:23:41PM -0700, yary wrote: : How does one create an anonymous multidimensional array in p6? Not an : array of arrays or a capture of captures... But I would expect a shaped array to be able to coerce either of those into its internal format. And coercing captures into

Anonymous multidimensional array

2009-06-01 Thread yary
How does one create an anonymous multidimensional array in p6? Not an array of arrays or a capture of captures... I'm guessing it involves Array.new(:shape) or something like :shape(2;2), and that it's not yet implemented in Rakudo. Is anonymous multidimensional array creation cove

Re: pop, push, reverse, sort, and splice on a multidimensional array

2005-03-16 Thread Larry Wall
On Tue, Mar 15, 2005 at 02:22:13AM -0600, Rod Adams wrote: : : my int @a is shape(Int ; Int) = (1..10 ; 2..100 :by(2) ; 4); : : $x = pop @a : push @a, $x; : @b = sort @a; : # etc : : I see two views to take with these cases. : : 1) flatten the array to one dimension, and act accordingly. : : o

pop, push, reverse, sort, and splice on a multidimensional array

2005-03-15 Thread Rod Adams
my int @a is shape(Int ; Int) = (1..10 ; 2..100 :by(2) ; 4); $x = pop @a push @a, $x; @b = sort @a; # etc I see two views to take with these cases. 1) flatten the array to one dimension, and act accordingly. or 2) assume my int @a is shape(Int ; Int); my @a is Array of Array of int; Mean exactly

Re: multidimensional array

2002-07-08 Thread Josef Höök
l == 2 in first position and pos->next.upper_init_val == 3 I've been thinking about this and i dont think its the best way to store init values .. i am currently thinking of creating a seperate POS at begining of the PMC Buffer that needs to be al

Re: multidimensional array

2002-07-02 Thread Dan Sugalski
At 9:45 PM +0100 7/2/02, Nicholas Clark wrote: >On Thu, Jun 27, 2002 at 05:42:10PM +0200, Josef Höök wrote: >> I've been thinking abit on howto implement multidimensional arrays and >> i found that its quite tricky :). I'm currently thinking of having >> a structure that contains a data pointer

Re: multidimensional array

2002-07-02 Thread Nicholas Clark
On Thu, Jun 27, 2002 at 05:42:10PM +0200, Josef Höök wrote: > I've been thinking abit on howto implement multidimensional arrays and > i found that its quite tricky :). I'm currently thinking of having > a structure that contains a data pointer and its location in every > dimension something like

Re: multidimensional array

2002-07-02 Thread Dan Sugalski
At 5:42 PM +0200 6/27/02, =?latin1?Q?Josef_H=F6=F6k?= wrote: >I've been thinking abit on howto implement multidimensional arrays >and >i found that its quite tricky :). I'm currently thinking of >having >a structure that contains a data pointer and its location in every >di

multidimensional array

2002-06-27 Thread Josef Höök
I've been thinking abit on howto implement multidimensional arrays and i found that its quite tricky :). I'm currently thinking of having a structure that contains a data pointer and its location in every dimension something like this:

Re: RFC 204 (v2) Arrays: Use list reference for multidimensional array access

2000-09-27 Thread Nathan Wiger
Bart Lateur wrote: > > >The problem is that > > > > $name = "myarray"; > > @$name = (1,2,3); > > print @$name[0,1]; # 1,2 > > > >Is very consistent currently. Change one and you have to change the > >precedence and parsing of all symbolic refs. > > You are suggesting to keep a weird prece

Re: RFC 204 (v2) Arrays: Use list reference for multidimensional array access

2000-09-26 Thread Bart Lateur
On Mon, 25 Sep 2000 19:26:38 -0700, Nathan Wiger wrote: >> I agree with both of you. It would be nice if @$ precedence worked as Bart >> specified, but I still think that arrays should be arrays. > >The problem is that > > $name = "myarray"; > @$name = (1,2,3); > print @$name[0,1]; # 1,2 >

Re: RFC 204 (v2) Arrays: Use list reference for multidimensional array access

2000-09-25 Thread Nathan Wiger
> I agree with both of you. It would be nice if @$ precedence worked as Bart > specified, but I still think that arrays should be arrays. The problem is that $name = "myarray"; @$name = (1,2,3); print @$name[0,1]; # 1,2 Is very consistent currently. Change one and you have to change t

Re: RFC 204 (v2) Arrays: Use list reference for multidimensional array access

2000-09-25 Thread Jeremy Howard
Buddha Buck wrote: > The main problem I see are these: > > @array = ([1,2],[3,4]); # 2-dimensional array, using LOL syntax > print $array[[1,1]]; # prints 4, OK > print $array[1]; # prints ? > print $array[[1,1,1]]; # prints ? > print $array[[1]]; # prints ? > > Ac

Re: RFC 204 (v2) Arrays: Use list reference for multidimensional array access

2000-09-25 Thread Buddha Buck
inds of behavious, depending on the contents > of a variable, as we have with symbolic references versus anonymous > arrays/hashes. > > What will this return? > > $ary[$index] > > It looks like a plain and simple array item, but what if $index is an > array ref?

Re: RFC 204 (v2) Arrays: Use list reference for multidimensional array access

2000-09-25 Thread Bart Lateur
On Fri, 22 Sep 2000 08:58:10 +1100, Jeremy Howard wrote: >Bart Lateur wrote: >> Hmm... the problem is, I think, that array references and ordinary >> scalars are both scalars. >> >That's true, but they're scalars with different interfaces. In particular, >an array ref can be dereferenced and prov

Re: RFC 204 (v2) Arrays: Use list reference for multidimensional array access

2000-09-21 Thread Jeremy Howard
Bart Lateur wrote: > Hmm... the problem is, I think, that array references and ordinary > scalars are both scalars. > That's true, but they're scalars with different interfaces. In particular, an array ref can be dereferenced and provides an array in doing so. If an index can do this, then it's a

RFC 202 (v2) Arrays: Overview of multidimensional array RFCs (RFC 203 through RFC 207)

2000-09-21 Thread Perl6 RFC Librarian
This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Arrays: Overview of multidimensional array RFCs (RFC 203 through RFC 207) =head1 VERSION Maintainer: Jeremy Howard <[EMAIL PROTECTED]> Date: 8 Sep 2000 Last Modified: 21 Sep 2000 Mailin

Re: RFC 204 (v2) Arrays: Use list reference for multidimensional array access

2000-09-21 Thread Bart Lateur
On 20 Sep 2000 04:06:02 -, Perl6 RFC Librarian wrote: >Ilya Zakharevich brought up the issue of a potential problem with >objects which use blessed list references as their internal structure, >and their use as indices. Given a Bignum class, which stores its >(external) value internally as a

RFC 204 (v2) Arrays: Use list reference for multidimensional array access

2000-09-19 Thread Perl6 RFC Librarian
This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Arrays: Use list reference for multidimensional array access =head1 VERSION Maintainer: Buddha Buck <[EMAIL PROTECTED]> Date: 8 Sep 2000 Last Modified: 19 Sep 2000 Mailing List:

RFC 204 (v1) Array: Use list reference for multidimensional array access

2000-09-08 Thread Perl6 RFC Librarian
This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Array: Use list reference for multidimensional array access =head1 VERSION Maintainer: Buddha Buck <[EMAIL PROTECTED]> Date: 8 September 2000 Mailing List: [EMAIL PROTECTED] Number: 204 V

RFC 202 (v1) Arrays: Overview of multidimensional array RFCs (RFC 203 through RFC 207)

2000-09-08 Thread Perl6 RFC Librarian
This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Arrays: Overview of multidimensional array RFCs (RFC 203 through RFC 207) =head1 VERSION Maintainer: Jeremy Howard <[EMAIL PROTECTED]> Date: 8 September 2000 Mailing List: [EMAIL PROTECTED]

RFC 203 (v1) Arrays: Overview of multidimensional array RFCs (RFC 203 through RFC 207)

2000-09-08 Thread Perl6 RFC Librarian
This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Arrays: Overview of multidimensional array RFCs (RFC 203 through RFC 207) =head1 VERSION Maintainer: Jeremy Howard <[EMAIL PROTECTED]> Date: 8 September 2000 Mailing List: [EMAIL PROTECTED]