Also, I just put a small functional programming library for Lua on GitHub about an hour before reading this: https://github.com/davidhollander/fn Here's an example of how to create a sum function with Fold Left and an addition function:
require'fn'
sum = fn.partial( fn.foldl, function(a, b) return a+b end)
x = sum(1, 2, 3, 4, 5, 6, 7, 8, 9)
print(x)
-- 45
If you are wondering why readline (history) support is missing from the interpreter and how to add it: http://dhllndr.posterous.com/adding-readline-support-to-luaj...
Also, I just put a small functional programming library for Lua on GitHub about an hour before reading this: https://github.com/davidhollander/fn Here's an example of how to create a sum function with Fold Left and an addition function:
...and for anyone who hasn't tried LuaJIT2: http://luajit.org/download.html