lua-users home
lua-l archive

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


Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote :
>>foreachi() 
>>
>>--->   foreachindex(list, function [, start [,stride [,end]]] )
>I'm sorry, but I'm a bit lost here. Are you proposing a new function called
>"foreachindex", simila to "foreachi", except that it would accept 3 additional

It is just an idea.

proposal.1   foreachi()  with more 3 arg.

In my experience, I ended up with creating my own version and not using 
the standard function foreachi(). I am not sure about how foreachi()
is accepted as a standard function in Lua, but 
proposal.1 seems to be a trivial task on src/lbuiltin.c which also keeps 
compatibility. I am sorry, I did not coded yet.

proposal.2   obsolete foreachi(), introduce foreachindex() with +3 arg

if students mixed up foreachi and foreach, they have a nightmare.
So, teachers can take a following strategy, but it is not good.

foreachindex=foreachi
foreachi=nil

I follow your naming anyway. But I just wonder, foreachi() is rather 
young and may have a chance to change.

________________________________________
Yutaka UENO  Electrotechnical Laboratory
1-1-4 Umezono, Tukuba 305-8568 Japan  TEL +(298)61-5965 /FAX 5938