[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Addition of map() and filter().
- From: Steven Johnson <steve@...>
- Date: Mon, 12 Oct 2009 17:17:01 -0500
On Mon, Oct 12, 2009 at 4:50 PM, André Ericsson <eandre@gmail.com> wrote:
>> I may have missed something while reading through this, but why not
>> use tables, like this?
>> function tostringall(...)
>> local t={...}
>> for k,v in ipairs(t)
>> t[k]=tostring(v)
>> end
>> return unpack(t)
>> end
>
> I believe the reasoning against that was garbage creation concerns.
> The simple cases at the beginning of the function were added due to
> performance concerns.
There have been proposals now and then to add an apairs() iterator, which would
behave like ipairs(), but over its arguments instead of a table's
array part. A little
while back I mentioned one that I had written with minimal garbage in mind:
http://lua-users.org/lists/lua-l/2009-06/msg00358.html