Skip to content
Permalink
Browse files

Add skip-one method to appropriate PredictiveIterators

  • Loading branch information...
lizmat committed Sep 23, 2018
1 parent b22edce commit e54885e5e6d71bb6ab6d7f4eb86fe21dd9aee3de
@@ -705,6 +705,7 @@ class Rakudo::Iterator {
?? nqp::chr($!i)
!! IterationEnd
}
method skip-one() { ( $!i = $!i + 1 ) <= $!n }
method push-all($target --> IterationEnd) {
my int $i = $!i;
my int $n = $!n;
@@ -1876,6 +1877,7 @@ class Rakudo::Iterator {
IterationEnd
)
}
method skip-one() { nqp::isle_i(($!i = nqp::add_i($!i,1)),$!last) }
method push-exactly($target, int $batch-size) {
nqp::stmts(
(my int $todo = nqp::add_i($batch-size,1)),
@@ -2650,7 +2652,6 @@ class Rakudo::Iterator {
)
)
}

method push-exactly($target, int $batch-size) {
nqp::stmts(
(my int $todo = nqp::add_i($batch-size,1)),
@@ -3674,6 +3675,7 @@ class Rakudo::Iterator {
nqp::p6bindattrinvres(nqp::create(self),self,'$!value',value)
}
method pull-one() is raw { $!value }
method skip-one(--> True) { }
method sink-all(--> IterationEnd) { }
method count-only(--> Inf) { }
method bool-only(--> True) { }
@@ -180,9 +180,8 @@ my class Range is Cool does Iterable does Positional {
method !SET-SELF(\i,\n) { $!i = i + 1; $!n = n; self }
method new(\i,\n) { nqp::create(self)!SET-SELF(i,n) }

method pull-one() {
( $!i = $!i - 1 ) >= $!n ?? $!i !! IterationEnd
}
method pull-one() { ( $!i = $!i - 1 ) >= $!n ?? $!i !! IterationEnd }
method skip-one() { ( $!i = $!i - 1 ) >= $!n }
method push-all($target --> IterationEnd) {
my int $i = $!i;
my int $n = $!n;
@@ -224,6 +223,7 @@ my class Range is Cool does Iterable does Positional {
?? nqp::chr($!i)
!! IterationEnd
}
method skip-one() { ( $!i = $!i - 1 ) >= $!n }
method push-all($target --> IterationEnd) {
my int $i = $!i;
my int $n = $!n;
@@ -192,6 +192,9 @@
IterationEnd
)
}
method skip-one() {
nqp::islt_i(($!pos = nqp::add_i($!pos,1)),nqp::elems($!reified))
}
method push-all($target --> IterationEnd) {
nqp::stmts(
(my int $elems = nqp::elems($!reified)),
@@ -359,6 +359,9 @@ my class Str does Stringy { # declared in BOOTSTRAP
IterationEnd
)
}
method skip-one() {
nqp::islt_i(($!pos = nqp::add_i($!pos,1)),$!chars)
}
method push-all($target --> IterationEnd) {
nqp::stmts(
(my str $str = $!str), # locals are faster
@@ -31,6 +31,9 @@ my class Uni does Positional[uint32] does Stringy is repr('VMArray') is array_ty
IterationEnd
)
}
method skip-one {
nqp::islt_i(($!i = nqp::add_i($!i, 1)), $!els)
}
method push-all($target --> IterationEnd) {
nqp::stmts(
(my $uni := $!uni), # lexicals faster than attrs
@@ -1658,7 +1658,7 @@ my class array does Iterable {
}

#- start of generated part of shapedintarray role -----------------------------
#- Generated on 2018-09-12T23:22:29+02:00 by tools/build/makeNATIVE_SHAPED_ARRAY.p6
#- Generated on 2018-09-23T11:51:05+02:00 by tools/build/makeNATIVE_SHAPED_ARRAY.p6
#- PLEASE DON'T CHANGE ANYTHING BELOW THIS LINE

role shapedintarray does shapedarray {
@@ -2037,6 +2037,9 @@ my class array does Iterable {
IterationEnd
)
}
method skip-one() {
nqp::islt_i(($!pos = nqp::add_i($!pos,1)),nqp::elems($!list))
}
method push-all($target --> IterationEnd) {
nqp::stmts(
(my int $elems = nqp::elems($!list)),
@@ -2218,7 +2221,7 @@ my class array does Iterable {
#- end of generated part of shapedintarray role -------------------------------

#- start of generated part of shapednumarray role -----------------------------
#- Generated on 2018-09-12T23:22:29+02:00 by tools/build/makeNATIVE_SHAPED_ARRAY.p6
#- Generated on 2018-09-23T11:51:05+02:00 by tools/build/makeNATIVE_SHAPED_ARRAY.p6
#- PLEASE DON'T CHANGE ANYTHING BELOW THIS LINE

role shapednumarray does shapedarray {
@@ -2597,6 +2600,9 @@ my class array does Iterable {
IterationEnd
)
}
method skip-one() {
nqp::islt_i(($!pos = nqp::add_i($!pos,1)),nqp::elems($!list))
}
method push-all($target --> IterationEnd) {
nqp::stmts(
(my int $elems = nqp::elems($!list)),
@@ -2778,7 +2784,7 @@ my class array does Iterable {
#- end of generated part of shapednumarray role -------------------------------

#- start of generated part of shapedstrarray role -----------------------------
#- Generated on 2018-09-12T23:22:29+02:00 by tools/build/makeNATIVE_SHAPED_ARRAY.p6
#- Generated on 2018-09-23T11:51:05+02:00 by tools/build/makeNATIVE_SHAPED_ARRAY.p6
#- PLEASE DON'T CHANGE ANYTHING BELOW THIS LINE

role shapedstrarray does shapedarray {
@@ -3157,6 +3163,9 @@ my class array does Iterable {
IterationEnd
)
}
method skip-one() {
nqp::islt_i(($!pos = nqp::add_i($!pos,1)),nqp::elems($!list))
}
method push-all($target --> IterationEnd) {
nqp::stmts(
(my int $elems = nqp::elems($!list)),
@@ -420,6 +420,9 @@ for $*IN.lines -> $line {
IterationEnd
)
}
method skip-one() {
nqp::islt_i(($!pos = nqp::add_i($!pos,1)),nqp::elems($!list))
}
method push-all($target --> IterationEnd) {
nqp::stmts(
(my int $elems = nqp::elems($!list)),

0 comments on commit e54885e

Please sign in to comment.
You can’t perform that action at this time.