lua-users home
lua-l archive

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


On Sun, Apr 4, 2010 at 3:31 PM, Florian Weimer <fw@deneb.enyo.de> wrote:
> You should probably look at a range-based reimplementation of the
> containers and algorithms framework.  Andrei Alexandrescu has written
> about this, and there's an implementation for the language D.

Interesting stuff - Boost::range certainly makes a lot of sense in the
C++ STL context where iterators are always given as pairs; ranges
encapsulate these pairs.

The Lua equivalent is not obvious.  In PL ranges can be expressed as
filters, like so seq(io.lines()):skip(1):take(10) (skip first line,
take the next 10) but range seq(s,start,end) is another way. And
ipairs_range(t,start,end) is a useful shortcut.

Definitely some interesting experiments could be made in this
direction, but I have other projects calling my name at the moment...