lua-users home
lua-l archive

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

> Here's an alternative which doesn't make as_table freely available:

But, as I said, you'll need to support an unpack method and probably some
other operations as well.  This makes things a bit more complicated.

> Unfortunately, this creates three tables (one empty) and a closure
> for each tuple, while Wim's original only creates two tables for
> each closure.

Yup.  That was one reason to take the low road...  (plus I'm lazy ;-)

> For a specific tuple implementation, like a vector, you can also use a
> functional approach (this is more or less adapted from SICP, I think)

Nice!  A bit like the functional implementation in Lua of Lisp's cons, cdr
etc. that I saw somewhere.  Or was that you as well Rici?