That's most likely a bug in the XS implementation of slide.
I looked into the Pure Perl implementation in List::MoreUtils::PP, and it looked fine, it's literally using map
And a test reveals, that it really works like it should.
use v5.12; use warnings; use Data::Dumper; BEGIN { $ENV{LIST_MOREUTILS_PP} = 1 }; # enforce PP version, comment f +or XS use List::MoreUtils qw/slide/; my @x= split',', q(a,a,a,a,b,c,c,a,a,d,e,e,e,e); print Dumper slide { $a ne $b ? $b : () } "", @x;
$VAR1 = 'a'; $VAR2 = 'b'; $VAR3 = 'c'; $VAR4 = 'a'; $VAR5 = 'd'; $VAR6 = 'e';
$VAR1 = 'a'; $VAR2 = undef; $VAR3 = undef; $VAR4 = undef; $VAR5 = 'b'; $VAR6 = 'c'; $VAR7 = undef; $VAR8 = 'a'; $VAR9 = undef; $VAR10 = 'd'; $VAR11 = 'e'; $VAR12 = undef; $VAR13 = undef; $VAR14 = undef;
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
In reply to Re^2: reduce like iterators (BUG in List::MoreUtils::slide)
by LanX
in thread reduce like iterators
by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |