[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: proper tail calls?
- From: "Nathan Linger" <nathan.linger@...>
- Date: Fri, 10 Mar 2006 16:16:10 -0800
>From an enthusiastic new Lua programmer,
I wrote a simple little package for lazy evaluation consisting of just
two functions, delay and force.
I then wrote a simple test program to try it out. It constructs and
traverses an infinite stream, printing out its elements.
I wrote the test program in two styles, procedural and functional.
Due to Lua's proper tail recursion, I expected the two to be
operationally equivalent, but the functional version causes a stack
All the code is attached at the end.
What am I to make of this? A bug in my program or in Lua? Just to
clarify, I'm using Lua 5.0.2.