lua-users home
lua-l archive

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


I learnt functional programming in Haskell and find
it very useful in making more concise and precise
programs, in many cases. I also applies it in writing
python programs when possible as it already has many
HOF like
map/filter/foldl etc.

I am wondering if this has been discussed before that
FP/HOF is good or just a waste of time in lua(say it
is against its design or idioms or whatever).

I tried to implement some of them in lua but have some
questions :

1. performance wise, would it be better to use
coroutine to simulate the "lazy" behaviour of generic
iterators or using a closure to remember the states ? 

2. the default behaviour of the for/loop iterators
expect k,v pairs on each iteration, should this be in
general adopted for custom iterators ?

3. I believe for/loop should have the best performance
comparing with repeat/while. But are their speed
difference between repeat and while ?

thanks and regards,


Yahoo! DSL ? Something to write home about. 
Just $16.99/mo. or less.