Thanks to all who responded to my question about iteration with skips.
Very helpful. I'm going with recursion, because a) I miss my cars and
cdrs; and b) I forgot to mention that I have a list of lists, for which
recursion is quite natural.
Here's a proposal for the wiki. Howsabout a "Lexicon of Lua Idioms"
section? The idea would be to adhere to a more-or-less formal
structure, along the lines of "Cookbook" books for e.g. Perl.
Statement of Problem:
Iterate over a list of elements, skipping based on some predicate.
Well, for this simple problem we got 3 or 4 different idioms. Each can
have a section. Since it's a wiki we might get some interesting stuff
on pros and cons of different approaches. Not to mention comparison
with other languages.
I find there's lots of useful info on the wiki, but sometimes its hard
to find what I need. Indeed, it took me longer than it should have to
track down "loadstring"; I knew I had seen it, but couldn't remember the
name. So it would be (maybe) more useful to have pages organized by
Problem Statements. For loadstring, I could see e.g.
- Problem: Execute a dynamically built expression
- Problem: Route execution based on user-supplied logic
The sample code page is nice, but it's organized by computational
concepts (lazy sort, etc), rather than practical problems.