lua-users home
lua-l archive

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


On Tue, Dec 18, 2012 at 7:59 AM, Peter Aronoff <telemachus@arpinum.org> wrote:
> On Tue Dec 18 2012 @ 12:42, Dirk Laurie wrote:
>> I've analyzed to myself why I felt much more enthusiastic
>> about Microlight in February than I do now.  It's simple: I've
>> been off Python for ten months longer.  I don't  feel a need
>> for e.g. `class`, `callable`, `map` and `filter` any more. I find it
>> more readable to write the equivalent in plain Lua.  The jury
>> is still out on `range`.
>
> I'm curious about the end: "I find it more readable to write the equivalent
> in plain Lua." I've been using Lua more and more lately (instead of Ruby or
> Bash or previously Perl), and I already have my own general-purpose utility
> module that includes `map`, `filter`, `partition`, etc. I understand the
> idea that they are simple to write in plain Lua, but why would you ever
> want to write them *twice* in plain Lua? (Just curious, not trolling.)
>

a builtin map would be in the position of looking at the function
signature. this is useful for determining how many members of the list
to pop

`map(f, l)' would pop 3 items at a time in set `l' if given a tertiary
function. the solutions in other languages are, e.g., map3, map4, ...,
mapn

`for' could be internally implemented as `map', ensuring that the
latter isn't some underperforming afterthought for functional
programmers