A basic challenge of iterators
Let's try
sub mymap(@list, &block) { my @result; while @list { push @result, &block(@list.shift); } @result; } mymap($file.lines, &block);continued...
Perl 6 | More laziness and lists | #13 |
Let's try
sub mymap(@list, &block) { my @result; while @list { push @result, &block(@list.shift); } @result; } mymap($file.lines, &block);continued...
Copyright © 2012 http://www.pmichaud.com/2012/pres/ |