From c967cb6cc825722991ac0b9a9029cbeb6bd348fe Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Wed, 22 Nov 2017 23:24:29 +0000 Subject: [PATCH] Revert "Expose new R:I:While/Until in .head/.tail" This reverts commit 76fcea1e18455fac9e71ab4ecc2ef42789d7035e. https://irclog.perlgeek.de/perl6-dev/2017-11-22#i_15484290 --- src/core/Any-iterable-methods.pm | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/core/Any-iterable-methods.pm b/src/core/Any-iterable-methods.pm index 2810157f14b..6de8bdbd18a 100644 --- a/src/core/Any-iterable-methods.pm +++ b/src/core/Any-iterable-methods.pm @@ -1823,9 +1823,6 @@ Did you mean to add a stub (\{...\}) or did you mean to .classify?" Rakudo::Iterator.AllButLastNValues(self.iterator,-($w(0).Int)) ) } - multi method head(Any:D: Callable:D $cond) { - Seq.new(Rakudo::Iterator.While(self.iterator,$cond)) - } multi method head(Any:D: $n) { Seq.new(Rakudo::Iterator.NextNValues(self.iterator,$n)) } @@ -1841,24 +1838,19 @@ Did you mean to add a stub (\{...\}) or did you mean to .classify?" $pulled ) } - multi method tail(Any:D: WhateverCode $w) { + multi method tail(Any:D: $n) { Seq.new( nqp::if( - nqp::isgt_i((my $skip := -($w(0).Int)),0), + nqp::istype($n,WhateverCode) + && nqp::isgt_i((my $skip := -($n(0).Int)),0), nqp::stmts( (my $iterator := self.iterator).skip-at-least($skip), $iterator ), - self.iterator + Rakudo::Iterator.LastNValues(self.iterator,$n,'tail') ) ) } - multi method tail(Any:D: Callable:D $w) { - Seq.new(Rakudo::Iterator.Until(self.iterator,$w)) - } - multi method tail(Any:D: $n) { - Seq.new(Rakudo::Iterator.LastNValues(self.iterator,$n,'tail')) - } proto method minpairs(|) {*} multi method minpairs(Any:D:) {