lua-users home
lua-l archive

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

 >> I guess there should be a better example in the test directory that
uses upvalues.

   That reminds me:  I think a few more examples in general would be a good
thing.   What kind?

   I like the little snippets that can be found in (for example) K&R's C
book.  I think they show how the authors themselves intended the language
to be used.  For instance, although there are a probably a million ways to
write a "bit counter" routine, it is instructive for beginners to see
specificially how the authors did it.  Helps get into the "mind-set" of the

   The snippets are usually trivial and short, focusing on a very
well-defined and limited problem -- but one that can be solved in a unique
way with the particular language.  Anything that is classic "first
semester" homework in an algorithms class might be a good candidate.  For
instance E's sieve, recently posted for benchmarking was a good example,
how might you yourself code that routine to take best advantage of Lua's
architecture?  (rhetorical question) 

   Take, for instance, the fibonacci function, which is self-described as
"inefficient".  OK then, is there a BETTER way to do it with Lua?  (again
rhetorical)  In order to illustrate why a given technique is preferred.