In Seq§

See primary documentation in context for method skip

multi method skip(Seq:D:)
multi method skip(Seq:D: Whatever)
multi method skip(Seq:D: Callable:D $w)
multi method skip(Seq:D: Int() $n)
multi method skip(Seq:D: $skip, $produce)

Returns a Seq containing whatever is left of the invocant after throwing away $n of the next available values. Negative values of $n count as 0. Also can take a WhateverCode to indicate how many values to skip from the end. Will block on lazy Seqs until the requested number of values have been discarded.

say (1..5).Seq.skip;      # OUTPUT: «(2 3 4 5)␤»
say (1..5).Seq.skip(3);   # OUTPUT: «(4 5)␤»
say (1..5).Seq.skip(5);   # OUTPUT: «()␤»
say (1..5).Seq.skip(-1);  # OUTPUT: «(1 2 3 4 5)␤»

Calling it with Whatever will return an empty Seq:

say <1 2 3>.Seq.skip(*);  # OUTPUT: «()␤»

The multi that uses a Callable is intended mainly to be used this way:

say (1..5).Seq.skip(*-3); # OUTPUT: «(3 4 5)␤»

Instead of throwing away the first $n elements, it throws away everything but the elements indicated by the WhateverCode, in this case all but the last three elements.

As of language version 6.e (early implementation exists in Rakudo compiler 2022.12+), it is also possible to specify multiple argument values. These are then interpreted as number of values to produce, then skip, then produce, etc.

say (1..12).Seq.skip(2,3,4); # OUTPUT: «(3 4 5 10 11 12)␤»

This first skipped 2 values, then produced 3 values (3, 4, 5), skipped 4 values and then produced the rest (10, 11, 12).

If the final value specified is in a "produce" position, then the rest of the Seq will be skipped. If the final value is in a "skip" position, then the rest of the Seq will be produced.

say (1..10).Seq.skip(2,3,1,2); # OUTPUT: «(3 4 5 7 8)␤»
say (1..10).Seq.skip(2,3,1);   # OUTPUT: «(3 4 5 7 8 9 10)␤»

If a Whatever is specified in a "produce" position, it will cause the rest of the Seq to be produced. Otherwise, it will cause the rest if the Seq to be skipped.

say (1..10).Seq.skip(2,*);   # OUTPUT: «(3 4 5 6 7 8 9 10)␤»
say (1..10).Seq.skip(2,3,*); # OUTPUT: «(3 4 5)␤»

If you want to start with producing values instead of skipping, specify 0 as the first value.

say (1..10).Seq.skip(0,3,4); # OUTPUT: «(1 2 3 8 9 10)␤»

If you want an unending repeating pattern of skips and produces, you can specify the arguments as an unending Seq themselves.

say (^20).Seq.skip(|(2,3) xx *); # OUTPUT: «(0 1 5 6 10 11 15 16)␤»

In module Test§

See primary documentation in context for sub skip

multi skip()
multi skip($reason, $count = 1)

Skip $count tests, giving a $reason as to why. By default only one test will be skipped. Use such functionality when a test (or tests) would die if run.

sub num-forward-slashes($arg) { ... } ;

if $*KERNEL ~~ 'linux' {
    is num-forward-slashes("/a/b"),             2;
    is num-forward-slashes("/a//b".IO.cleanup), 2;
}
else {
    skip "Can't use forward slashes on Windows", 2;
}

Note that if you mark a test as skipped, you must also prevent that test from running.

In Any§

See primary documentation in context for routine skip

multi method skip()
multi method skip(Whatever)
multi method skip(Callable:D $w)
multi method skip(Int() $n)
multi method skip($skip, $produce)

Creates a Seq from 1-item list's iterator and uses Seq.skip on it, please check that document for real use cases; calling skip without argument is equivalent to skip(1).

multi skip(\skipper, +values)

As of release 2022.07 of the Rakudo compiler, there is also a "sub" version of skip. It must have the skip specifier as the first argument. The rest of the arguments are turned into a Seq and then have the skip method called on it.

In Supply§

See primary documentation in context for method skip

method skip(Supply:D: Int(Cool) $number = 1 --> Supply:D)

Returns a new Supply which will emit all values from the given Supply except for the first $number values, which will be thrown away.

my $supplier = Supplier.new;
my $supply = $supplier.Supply;
$supply = $supply.skip(3);
$supply.tap({ say $_ });
$supplier.emit($_) for 1..10; # OUTPUT: «4␤5␤6␤7␤8␤9␤10␤»