Re: How do I remove N elements

2017-03-21 Thread ToddAndMargo

On 03/20/2017 11:18 PM, Norman Gaywood wrote:


On 21 March 2017 at 15:39, ToddAndMargo > wrote:

from the beginning of an array?


untested but same as perl5:

splice @list, 0, $N;

https://docs.perl6.org/routine/splice




I know about shift, but that is one at a time.  I suppose I
could do a loo[, but it would be nice to do it all at once.


Many thanks,
-T


Hi Norman,

That was easy.   Thank you!

-T

perl6 -e 'my @foo = ; @foo.splice(0,3); say @foo;'
[d e f g]

@foo.splice(1,3); say @foo;'
[a e f g]


--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


Re: How do I remove N elements

2017-03-21 Thread Norman Gaywood
On 21 March 2017 at 15:39, ToddAndMargo  wrote:

> from the beginning of an array?
>

untested but same as perl5:

splice @list, 0, $N;

https://docs.perl6.org/routine/splice



> I know about shift, but that is one at a time.  I suppose I
> could do a loo[, but it would be nice to do it all at once.
>
>
> Many thanks,
> -T
>



-- 
Norman Gaywood, Computer Systems Officer
School of Science and Technology
University of New England
Armidale NSW 2351, Australia

ngayw...@une.edu.au  http://turing.une.edu.au/~ngaywood
Phone: +61 (0)2 6773 2412 <(02)%206773%202412>  Mobile: +61 (0)4 7862 0062

Please avoid sending me Word or Power Point attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html


How do I remove N elements

2017-03-20 Thread ToddAndMargo

from the beginning of an array?

I know about shift, but that is one at a time.  I suppose I
could do a loo[, but it would be nice to do it all at once.


Many thanks,
-T