sub tail { my $list = shift; if ( ref( $list->[1] eq 'CODE' ) { return $s->[1]->() ); else { return $s->[1] } } #### sub upto { my ($m, $n) = @_; return if $m > $n; node( $m, promise { upto($m+1, $n) } ); } #### sub promise (&) { $_[0] } #### sub node { my ($head, $tail) = @_; return [$head, $tail]; } #### 'Can't call method "promise" on an undefined value.' #### Odd number of elements in anonymous hash at stream.pl line 19. Use of uninitialized value in anonymous hash ({}) at stream.pl line 19. #### node( $m, promise ( upto($m+1, $n) ) );