Re: Multi-d array transforms (was Re: Array rotate)

2009-06-13 Thread Daniel Carrera
Larry Wall wrote: Nevertheless, for any major methods borrowed from Perl 6, I'm not inclined to change them that drastically. Much more likely to define them as sugar for the more general list operators: .push means .=append .unshiftmeans .=prepend .splice means

Re: Multi-d array transforms (was Re: Array rotate)

2009-06-13 Thread Jon Lang
On Fri, Jun 12, 2009 at 11:23 PM, Matthew Walton wrote: > Although some things may be able to be implemented far more > efficiently if they know that they're being called with infix:<.=> and > not with infix:<.>. Last I checked, Perl 6 had some types that are mutating and others that aren't (e.g.,

Re: Array rotate

2009-06-13 Thread John M. Dlugosz
Jon Lang dataweaver-at-gmail.com |Perl 6| wrote: On Fri, Jun 12, 2009 at 10:02 AM, yary wrote: I am tickled pink to see an Array "rotate" method in the settings spec S032, as I was thinking of writing up a little discussion on the very topic. Has there been discussion on using array rotate o

Re: Multi-d array transforms (was Re: Array rotate)

2009-06-13 Thread John M. Dlugosz
Larry Wall larry-at-wall.org |Perl 6| wrote: We also need to consider the "dimension" of referentiality. I can see three levels here. Given @a.mung the .mung could return A) a modified @a (treat @a as mutable) B) a new array (treat @a as immutable) C) a remapped array whose e

Re: Array Dimensionality (Was: Re: Multi-d array transforms (was Re: Array rotate))

2009-06-13 Thread John M. Dlugosz
Larry Wall larry-at-wall.org |Perl 6| wrote: Alternately, we leave @@ (or @%) meaning ยข and instead let some other syntax take over the "pay attention to the capture's structure" semantics from @@. Maybe it's another use for the zen slice: "pay attention to the capture's structure" is a c

Re: Array Dimensionality (Was: Re: Multi-d array transforms (was Re: Array rotate))

2009-06-13 Thread John M. Dlugosz
Daniel Ruoso daniel-at-ruoso.com |Perl 6| wrote: So, how do I deal with a multidim array? Well, TIMTOWTDI... my @a = 1,[2,[3,4]]; say @a[1][1][1]; say @a[1;1;1]; # I'm not sure this is correct I think that it should be. That is, multi-dim subscript is always the same as chained subscrip

Re: Multi-d array transforms (was Re: Array rotate)

2009-06-13 Thread John M. Dlugosz
Daniel Carrera daniel.carrera-at-theingots.org |Perl 6| wrote: In addition, the current @a.shift is useful because it returns the element that was removed from the array, so you can do something with it: The change to the library synopses was checked in before you posted that, if I recall the

Re: Multi-d array transforms (was Re: Array rotate)

2009-06-13 Thread Larry Wall
On Sat, Jun 13, 2009 at 02:49:10PM -0500, John M. Dlugosz wrote: > Wow. The overarching logic for list assignment would have to compare > the containers and the arguments in the capture before doing the list > assignment to each container, in order to avoid cloning all the > containers on th

Re: Multi-d array transforms (was Re: Array rotate)

2009-06-13 Thread John M. Dlugosz
Larry Wall larry-at-wall.org |Perl 6| wrote: On Sat, Jun 13, 2009 at 02:49:10PM -0500, John M. Dlugosz wrote: Wow. The overarching logic for list assignment would have to compare the containers and the arguments in the capture before doing the list assignment to each container, in order t