Re: Array/list transformations.

2005-12-26 Thread Larry Wall
On Tue, Dec 27, 2005 at 12:10:45AM -0500, Rob Kinyon wrote: : Creating an array whose positions are aliases for positions in another : array can be useful. How about : : my @s := @a[0,2,4] is alias; : : @a[2] = 3; # @s[1] == 3 : @s[1] = 4; # @a[2] == 4 : : The default slicing behavio

Re: Array/list transformations.

2005-12-26 Thread Rob Kinyon
On 12/22/05, Jonathan Scott Duff <[EMAIL PROTECTED]> wrote: > On Thu, Dec 22, 2005 at 04:47:21PM +0100, Michele Dondi wrote: > > Also I wonder if one will be able to push(), pop(), etc. array slices as > > well whole arrays. A' la > > > > my @a=qw/aa bb cc dd ee/; > > my $s=pop @a[0..2]; # or [0,2

Re: Match objects

2005-12-26 Thread Luke Palmer
On 12/26/05, Patrick R. Michaud <[EMAIL PROTECTED]> wrote: > > I argue that by the structure of that rule, you should be able to tell > > which xs go with which y. > > ... > > Is there a counterargument that I'm not seeing? > > I'd say that if you want a structured rule, it should be written > that

(Array) introspection

2005-12-26 Thread Ilmari Vacklin
Hi all, do we have any specifications for array introspection, or introspection of data structures (including subroutines) in general? Say I have this array: my @array (1..9 --> Int); I think I get the first bit with .shape; what about the Int? Since arrays are glorified subroutines, per

Re: Problem with dwimmery

2005-12-26 Thread Daniel Hulme
> As a third possibility, could we huffman-code "do nothing" clauses by > leaving out the appropriate argument? That is: > > while $x-- && some_condition($x); That's a bit too short for my liking: it is likely to lead to the traditional C undetectable bug when you write while $x-- && some_cond

Re: Match objects

2005-12-26 Thread Patrick R. Michaud
On Mon, Dec 26, 2005 at 07:34:06PM +, Luke Palmer wrote: > On 12/26/05, Patrick R. Michaud <[EMAIL PROTECTED]> wrote: > > On Fri, Dec 23, 2005 at 02:09:19PM +, Luke Palmer wrote: > > > "x" ~~ / [ [ (x) ]* ]* / > > > > As I understand things, $/[0][0] would be "x". > > Hmm, that seems w

Re: Match objects

2005-12-26 Thread Luke Palmer
On 12/26/05, Patrick R. Michaud <[EMAIL PROTECTED]> wrote: > On Fri, Dec 23, 2005 at 02:09:19PM +, Luke Palmer wrote: > > "x" ~~ / [ [ (x) ]* ]* / > > As I understand things, $/[0][0] would be "x". Hmm, that seems wrong. Consider: "xxxyxxyxy" ~~ / [ [ (x) ]* (y) ]* / I argue that by

Re: Match objects

2005-12-26 Thread Patrick R. Michaud
On Fri, Dec 23, 2005 at 02:09:19PM +, Luke Palmer wrote: > What sort of match object should this return, supposing that it didn't > infinite loop: > > "x" ~~ / [ [ (x) ]* ]* / > > Should $/[0][0] be "x", or should $/[0][0][0] be "x"? If it's the > latter, then when do new top-level eleme