[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Penlight Libraries, First release
- From: steve donovan <steve.j.donovan@...>
- Date: Wed, 13 May 2009 15:28:33 +0200
On Wed, May 13, 2009 at 3:16 PM, David Manura <dm.lua@math2.org> wrote:
> No, this point is unrelated to what tablex does. I mean that the List
> operation t:map() does not modify t but rather returns a new object.
> This differs from t:reverse(), which modifies t in-place and returns
> itself.
>
Fine, that makes sense. While we are talking about List, it seems a
good idea to rename things properly and consistently with the rest of
Lua. For example, there is List.delete, which should be just
List.remove, just like the table function, except of course it returns
self for chaining. (a typo makes this function broken at the moment.)
List.index is precisely the same as tablex.find (the latter's name
seems to come from the STL, hence find_if). Having two names for
exactly the same operation is less than optimal. ('find' has
precedent in string.find.)
In fact, List.find_if (or whatever it should be called) is a useful
addition, since there are no existence-with-predicate methods for List
except the relatively expensive List.filter followed by a non-empty
check.
About List.reverse - it does _internally_ create a temporary, but then
copies it back.
steve d.
- References:
- Re: [ANN] Penlight Libraries, First release, Flemming Madsen
- Re: [ANN] Penlight Libraries, First release, steve donovan
- Re: [ANN] Penlight Libraries, First release, David Manura
- Re: [ANN] Penlight Libraries, First release, steve donovan
- Re: [ANN] Penlight Libraries, First release, Mark Hamburg
- Re: [ANN] Penlight Libraries, First release, David Manura
- Re: [ANN] Penlight Libraries, First release, steve donovan
- Re: [ANN] Penlight Libraries, First release, David Manura