Skip to content

Commit

Permalink
Adjust the MapIter.new() interface a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Jun 7, 2012
1 parent fef467a commit 43975a1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/Any.pm
Expand Up @@ -53,7 +53,7 @@ my class Any {
}

method map($block) is rw {
MapIter.new(:list(self), :block($block)).list
MapIter.new(self, $block, Bool::True).list
}

method min($by = &infix:<cmp>) {
Expand Down
4 changes: 2 additions & 2 deletions src/core/MapIter.pm
Expand Up @@ -6,14 +6,14 @@ my class MapIter is Iterator {
has $!first; # Is this the first iterator in the sequence?
has Mu $!items; # reified items we haven't consumed yet

method new(:$list!, :$block!, :$flattens = 1) {
method new($list, $block, $flattens = Bool::True) {
my $new := nqp::create(self);
$new.BUILD(nqp::p6listiter(nqp::list(nqp::p6decont($list)), $new),
$block, $flattens, True);
$new;
}

method BUILD(Mu \$listiter, \$block, $flattens, $first = False) {
method BUILD(Mu \$listiter, \$block, \$flattens, $first = False) {
nqp::bindattr($listiter, ListIter, '$!list', self) if nqp::isconcrete($listiter);
$!listiter := $listiter;
$!block = $block;
Expand Down

0 comments on commit 43975a1

Please sign in to comment.