lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>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
overflow!
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.

Nathan