lua-users home
lua-l archive

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


Adrián Pérez de Castro <aperez@igalia.com> wrote:
> The lua-itertools module provides a collection of functional utilities to
> use with coroutine-based iterators. One of the main goals is to provide
> composable functions which work well together. Parts of the API are
> loosely based on some of the Python builtins (e.g. map, filter), and the
> itertools [1] module.
> 
> So far the module includes functionality that I have needed myself. I am
> open to add additional functions — even if it's just a suggestion,
> contributions are appreciated :-)

Thanks so much for sharing this. I maintain a (somewhat) similar module
called tableutils. I mention it only because you may find it useful in
terms of functions and ideas to consider (or to avoid!). I know I’ll be
looking at itertools in a similar light.

For what it’s worth, I can think of two obvious differences:

1. itertools is, as you say, coroutine-based; tableutils is not. I’ll have
   to think about whether I should change this.
2. tableutils divides its functions between two (separately loadable)
   files: listutils and hashutils. In practice, I find that 90% of the
   tables I use in Lua are either list-like (i.e. sequences) or hash-like
   (i.e. dictionaries). So it made sense for me to provide helper functions
   for each type of table separately.

Anyhow, thanks again for writing and sharing itertools.

Best, Peter
-- 
We have not been faced with the need to satisfy someone else's
requirements, and for this freedom we are grateful.
    Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System