A basic challenge of iterators
sub mymap(@list, &block) { my $i = 0; my @result; while $i < @list.elems { push @result, &block(@list[$i]); $i = $i + 1; } @result; }
What happens if called as ...?
mymap($file.lines, &block)continued...
Perl 6 | More laziness and lists | #12 |
sub mymap(@list, &block) { my $i = 0; my @result; while $i < @list.elems { push @result, &block(@list[$i]); $i = $i + 1; } @result; }
What happens if called as ...?
mymap($file.lines, &block)continued...
Copyright © 2012 http://www.pmichaud.com/2012/pres/ |