lua-users home
lua-l archive

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


On Tue, Feb 21, 2012 at 9:11 AM, Ross Bencina
<rossb-lists@audiomulch.com> wrote:
> Other obvious names:
> Array
> Vector

I like Array, personally. And yes it's very much inspired by python-like lists.

>  is there really a strong reason that such a thing should be
> present in ml.

As long as it isn't the only way to access extra functionality.  I'm
open on this one; Jay has also raised concerns. Perhaps we do need
another module for 'useful classes'  (mlx is just a place to keep
experiments for now)

> I'm not sure I see the rationale. If it's just to provide python-like
> slicing then maybe a better approach is to add table:slice()

We already have ml.sub(), although part of me wants to name it ml.slice().

> Or are these lazy lists? more like python generators or C++ iterators.

We do have these in Lua, coming naturally from the for statement
semantics (e.g. io.lines(), string.gmatch(), even math.random (which
would be unbounded))  ml.collect() will make an array-like table out
of such iterators.[1]   I'm thinking of ml.iter() which filters an
interator, but I don't know if it will make the cut.

steve d.

[1] I called these 'sequences' in PL but that does conflict with the
use of the word in the manual. 'lazy list' might do the job.