On Thu, 07 Dec 2017 15:48:35 -0800, comdog wrote: > I first asked about this on Stackoverflow: > > https://stackoverflow.com/q/47704428/2766176 > > A .tail on a .tail appears to do the wrong thing: > > > my $list = <a b c d e f g h i j>; > (a b c d e f g h i j) > > > $list.tail(5).tail > Nil > > But throwing a list in there works: > > > $list.tail(5).list.tail > j > > Timo said: > > .tail and .tail(1) are implemented with > Rakudo::Iterator.LastValue and > Rakudo::Iterator.LastNValues respectively, which differ > quite a bit in implementation. > https://github.com/rakudo/rakudo/blob/master/src/core/Rakudo/Iterator.pm#L1807 > > And he figures: > > tail on the List takes an iterator and skips it ahead $n > items. then, the tail method on Seq calls count-only on > it to figure out how far to skip ahead to get the last > $m items. However, count-only on the first iterator just > gives you the total number of items in the original > list. It should probably either signal an error when > asked for count-only, or it should calculate the proper > amount of items left.
Thank you for the report. This is now fixed. Fix: https://github.com/rakudo/rakudo/commit/af9812fa73 Tests: https://github.com/perl6/roast/commit/88a12f6984f0b57e9 https://github.com/perl6/roast/commit/1743894c03