in reply to Re^7: Next Language to Learn
in thread Next Language to Learn
Is this supposed to be Haskell code or Haskell semantics?
For me it looks more like LISP phrased in Perl..
Did you mean:
?sub all_even_from{ my $even=shift; sub { $even+=2; } } $iter=all_even_from(4); print $iter->() for (1..5);
> so maybe your general idea of using an operator would lead in the right direction...
I didn't talk about operators but about tie.
Using Tie::Array you could try to tie the iterator to an array @even such that you can subsequently write something like this, _with_ lazy evaluation.
for (1 ..5) { print shift @even; }
again, show me what you like about Haskell - eg list comprehensions (???) - and I will see whats feasible.
Cheers Rolf
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^9: Next Language to Learn (Lazy Perl)
by rovf (Priest) on Apr 01, 2010 at 11:07 UTC | |
by LanX (Saint) on Apr 01, 2010 at 17:58 UTC | |
by rovf (Priest) on Apr 06, 2010 at 07:09 UTC |
In Section
Seekers of Perl Wisdom