Skip to content

Commit

Permalink
fix List.tree
Browse files Browse the repository at this point in the history
it got broken by the last API change of MapIter.new
  • Loading branch information
moritz committed Jul 22, 2012
1 parent e09fbe6 commit cd31947
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/List.pm
Expand Up @@ -39,14 +39,15 @@ my class List does Positional {
proto method tree(|$) {*} proto method tree(|$) {*}
multi method tree(List:U:) { self } multi method tree(List:U:) { self }
multi method tree(List:D:) { multi method tree(List:D:) {
MapIter.new(:list(self), :block(&itemify)).list; MapIter.new(self, &itemify, Mu).list;
} }
multi method tree(List:D: Cool $count as Int) { multi method tree(List:D: Cool $count as Int) {
$count <= 0 ?? self $count <= 0 ?? self
!! $count == 1 ?? self.tree !! $count == 1 ?? self.tree
!! MapIter.new( !! MapIter.new(
:list(self), self,
:block({.elems == 1 ?? $_ !! [.tree($count - 1)]}) {.elems == 1 ?? $_ !! [.tree($count - 1)]},
Mu
).list; ).list;
} }
multi method tree(List:D: &c) { multi method tree(List:D: &c) {
Expand Down

0 comments on commit cd31947

Please sign in to comment.