Segment violation (was Re: Why I could not cast string to int?)
H. S. Teoh
hsteoh at quickfur.ath.cx
Thu Feb 2 15:29:40 PST 2012
On Fri, Feb 03, 2012 at 12:10:01AM +0100, Timon Gehr wrote:
[...]
> LList!ulong fib(){
> LList!ulong r;
> r=cons(st(1UL),cons(st(1UL),lz(()=>zipWith((Lazy!ulong a,
> Lazy!ulong b)=>lz(()=>a+b),r,r.tail)())));
> return r;
> }
Whoa. A caching recursive definition of fibonacci. Impressive!
Now I wonder if we can do this with the Ackermann function... ;-)
T
--
"640K ought to be enough" -- Bill G., 1984.
"The Internet is not a primary goal for PC usage" -- Bill G., 1995.
"Linux has no impact on Microsoft's strategy" -- Bill G., 1999.
More information about the Digitalmars-d-learn
mailing list