lua-users home
lua-l archive

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

Oops, here is the code.

---------- Forwarded message ----------
From: Nathan Linger <>
Date: Mar 10, 2006 4:16 PM
Subject: proper tail calls?
To: Lua list <>

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


Attachment: thunk.lua
Description: Binary data