haskell prelude
Luc Duponcheel
luc.duponcheel at gmail.com
Thu Jun 21 06:33:10 PDT 2012
Some time ago Sven Eric Panitz posted an experimental haskell prelude
library to this group (one of his goals being to work with "infinite
iterables" (right?))
So I tried out something similar to
public class Test{
final private static Function2<Integer, Integer, Iterable<Integer>> fibs =
(Integer z, Integer y) -> cons(z, cons(y, fibs.eval(y, z + y)));
public static void main(String[] args){
System.out.println(take(5, fibs.eval(1, 1)));
}
}
but this results in a stack overflow
So my question to Sven (and others (?)) is:
is there an elegant similar way to define fibs without this issue?
thx
Luc
--
__~O
-\ <,
(*)/ (*)
reality goes far beyond imagination
More information about the lambda-dev
mailing list