lua-users home
lua-l archive

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


On Sun, Oct 6, 2013 at 10:23 PM, Jay Glascoe <jay.glascoe@gmail.com> wrote:
> I think normally I would do something like "map(theFunction, theList)"
> whereas Underscore has "map(theList, theFunction)".  What's cool about that,
> in Lua, is if your your list (table) is an object with "map" to be found
> somewhere in it's metatable's index, you can do "myObject:map(theFunction)"

Yep, I went through that as well with Penlight - so it works both
ways: there is tablex.imap (fn,t) (where t is a array-like table) but
the List class has a map method: ls:map(fn).

List is not really the right word but it comes from the early
lets-clone-Python stages of Penlight.