Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Aliasing an array slice
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Luke Palmer  
View profile  
 More options Jul 18 2003, 8:00 pm
Newsgroups: perl.perl6.language
From: fibon...@babylonia.flatirons.org (Luke Palmer)
Date: 18 Jul 2003 17:51:51 -0600
Local: Fri, Jul 18 2003 7:51 pm
Subject: Re: Aliasing an array slice

> David Storrs wrote:

> > Thinking about it, I'd rather see lvalue slices become a nicer version
> > of C<splice()>.

> >      my @start = (0..5);
> >      my @a = @start;

> >      @a[1..3] = qw/ a b c d e /;
> >      print @a;   #  0 a b c d e 4 5

> What would happen if I used 1,2,3 instead of 1..3?  Would it do the same
> thing?

Of course.

> I wanna know what happens if I do:

>        @a[0,2,4] = qw/ a b c d e /;

It would probably do the same as in Perl 5; the same thing as:

    @a[0,2,4] = << a b c >>;

(those << >> brackets are new shorthand for qw, not that qw is going
anywhere)

Luke

> --
> $a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
> );{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
> ]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.