A practical functional library for lua programmers.
Ported from the JavaScript version https://github.com/ramda/ramda
git clone https://github.com/moriyalb/lamda.git
sudo luarocks install --server=http://luarocks.org/manifests/moriyalb lamda
local R = require("lamda")
local sayHello = R.compose(R.join(" "), R.map(R.pipe(R.toUpper, R.trim, R.take(3))), R.split(","))
R.call(print, sayHello("Hello, Lamda!"))
see https://moriyalb.github.io/lamda/
I use luaunit to test all functions.
you can test the lamda function simple like
lua run_test_all.lua -v
- Immutable
- All functions is immutable without side effect.
- Functional
- You can write lua code in functional style.
- Auto curried
- Most function is auto curried. Placeholder is also supported.
- Based on [email protected]
-
nil
is the very annoy params in lua because it not onlynone
value but alsoabsent
argument. we can not tell the difference, so if we curry the method, the nil args is rejected to send or the method will return acurried
function as a invalid result. -
string type is treated as the array table.(in most function , but maybe expcetions)
-
transducer / lens / transformer is not supported now.
-
all sort method is none-stable.( we use the default lua table.sort method)
-
this lib support awesome functional usage in lua programming but may also comes with a performance price. make sure the tick/update method don't use much more of this lib.