lua-users home
lua-l archive

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


On Sun, Jan 3, 2010 at 6:59 PM, Mark Hamburg <mark@grubmah.com> wrote:
> I do, however, think examples like:
>
>        iseq(io.lines(arg[1])) (take,10) (foreach, print)
>
> Are probably clearer than:

Yes, mostly this idiom is for working on iterators, rather than
tables, and many of those iterators will represent input from a file
or a socket, etc.  Such data is potentially unbounded, multi-valued
and not fully accessible at any given instant, so is more general than
the table/array concept.

The performance of using iterator chains with such data would probably
be dominated by i/o.

steve d.

PS. I do still believe in for-loops. But life could be clearer without
so many of them.