Skip to content

Commit

Permalink
Implement simplest form of List.tree
Browse files Browse the repository at this point in the history
You can now say

   for (1, 2 Z 10, 20).tree { }

and have the loop bind $_ to the parcels (1, 10) and (2, 20) in turn
  • Loading branch information
moritz committed Oct 20, 2011
1 parent e17c139 commit bfedd99
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/List.pm
Expand Up @@ -27,7 +27,11 @@ my class List does Positional {
}
method list() { self }
method flattens() { $!flattens }


method tree() {
MapIter.new(:list(self), :block({ my $ = $_ })).list;
}

method Capture() {
self.gimme(*);
my $cap := nqp::create(Capture);
Expand Down

0 comments on commit bfedd99

Please sign in to comment.