Permalink
Browse files

sliding-window: handle list elements that are "falsy".

  • Loading branch information...
1 parent babe643 commit 4255853015c9d109988c7007c4c316b0a6f87087 @prakashk prakashk committed Dec 14, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/List/Utils.pm
View
@@ -3,7 +3,7 @@ module List::Utils;
sub sliding-window(@a, $n) is export(:DEFAULT) {
my $a-list = @a.iterator.list;
my @values;
- gather while my $a = $a-list.shift {
+ gather while defined(my $a = $a-list.shift) {
@values.push($a);
@values.shift if +@values > $n;
take @values if +@values == $n;

0 comments on commit 4255853

Please sign in to comment.