lua-users home
lua-l archive

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


On Fri, Dec 28, 2012 at 10:13 AM, David Manura <dm.lua@math2.org> wrote:
> A couple comments on only a quick look, assuming the meaning of the
> functions should be clear from the documentation alone:

That is fair, since we must go beyond 'Read the Source, Luke' as
advice on how to use libraries...

>   - "split a string into a table of strings separated by a delimiter."
> --> "split a delimited string into a table of strings."

That reads better. Sequence is the official term, although array is
clear enough (except when we speak of Array with a capital of
course!).   Number of splits works as expected, so that 2 gives us two
parts and so on, but this ought to be explicit.

>   - Is it obvious what $(1), $(true), and $(nil) should expand to?

This is gsub, so (a) $(1) is fine (b) $(true) is an error and (c)
$(nil) cannot happen. I'll make this more explicit, and use tostring()
to avoid errors at the cost of some correctness.

>   - no ml.writefile?  (See also lua-file-slurp.)

Logical enough!

> (6) ml.collect_until(n, ...)
>   - The word "until" suggests a variable number of iterations until a
> predicate n is met, like "repeat ... until n"

Sneakily named, because n is overloaded; it _can_ be a predicate which
ends the sequence.  Really should be collect_n and collect_until.

> (7) ml.imap
>   - Note: This and other functions based on it operate in-place.

It doesn't, but I agree that the docs should be clearer about that.
The in-place version is transform - not sure if that's a canonical
name for this operation (which naturally doesn't feature in the
functional lexicon)

> (11) Mixing naming conventions?  equals_keys/equalskey v.s. issubset/is_subset?

Ouch. Yes, that kind of thing irritates me as well. I like underscores
personally, any preferences?

steve d.