Skip to content

Commit

Permalink
be more robust when .count is Inf
Browse files Browse the repository at this point in the history
but does not cover all cases yet
  • Loading branch information
moritz committed Apr 24, 2012
1 parent b64c1e9 commit 11c0ab8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/core/List.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ my class List does Positional {


method munch($n is copy) { method munch($n is copy) {
$n = 0 if $n < 0; $n = 0 if $n < 0;
self.gimme($n) if nqp::not_i(nqp::istype($n, Int)) $n = self.gimme($n) if nqp::not_i(nqp::istype($n, Int))
|| nqp::not_i(nqp::islist($!items)) || nqp::not_i(nqp::islist($!items))
|| nqp::islt_i(nqp::elems($!items), nqp::unbox_i($n)); || nqp::islt_i(nqp::elems($!items), nqp::unbox_i($n));
nqp::p6parcel( nqp::p6parcel(
pir::perl6_shiftpush__0PPi(nqp::list(), $!items, nqp::unbox_i($n)), pir::perl6_shiftpush__0PPi(nqp::list(), $!items, nqp::unbox_i($n)),
Any Any
Expand Down
2 changes: 1 addition & 1 deletion src/core/MapIter.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ my class MapIter is Iterator {
my $argc = $!block.count; my $argc = $!block.count;
$argc = 1 if $argc < 1; $argc = 1 if $argc < 1;
my $count; my $count;
if nqp::istype($n, Whatever) { if nqp::istype($n, Whatever) || $argc === $Inf {
$count = ($!list.gimme(*).Num / $argc).ceiling.Int $count = ($!list.gimme(*).Num / $argc).ceiling.Int
} }
else { else {
Expand Down

0 comments on commit 11c0ab8

Please sign in to comment.