first commit
This commit is contained in:
18
perl/Examples/Chap8/it2stream.pl
Normal file
18
perl/Examples/Chap8/it2stream.pl
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
###
|
||||
### iterator-to-stream.pl
|
||||
###
|
||||
|
||||
## Chapter 8 section 1.4
|
||||
|
||||
use Stream 'node';
|
||||
|
||||
sub iterator_to_stream {
|
||||
my $it = shift;
|
||||
my $v = $it->();
|
||||
return unless defined $v;
|
||||
node($v, sub { iterator_to_stream($it) });
|
||||
}
|
||||
|
||||
1;
|
||||
Reference in New Issue
Block a user