Skip to content

moriyalb/lamda

Repository files navigation

Lamda

A practical functional library for lua programmers.
Ported from the JavaScript version https://github.com/ramda/ramda

Build Status unstable

Badge LICENSE MIT Licence

Install

From Github

    git clone https://github.com/moriyalb/lamda.git

From Luarocks

    sudo luarocks install --server=http://luarocks.org/manifests/moriyalb lamda

Usage

    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!"))

API

see https://moriyalb.github.io/lamda/

Test

I use luaunit to test all functions.
you can test the lamda function simple like

    lua run_test_all.lua -v

Features

  1. Immutable
    • All functions is immutable without side effect.
  2. Functional
    • You can write lua code in functional style.
  3. Auto curried
    • Most function is auto curried. Placeholder is also supported.

Ramda Version

Notice

  1. nil is the very annoy params in lua because it not only none value but also absent 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 a curried function as a invalid result.

  2. string type is treated as the array table.(in most function , but maybe expcetions)

  3. transducer / lens / transformer is not supported now.

  4. all sort method is none-stable.( we use the default lua table.sort method)

  5. 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.

About

functional lua ( based on ramda )

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published