A functional Lua extension library.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs
.gitignore
.travis.yml
CHANGE.log
LICENSE
README.md
benchmark.lua
f.lua
f.lua-1.6-0.rockspec
test.lua

README.md

f.lua

A functional Lua extension library.

Build Status License Krihelimeter

Compatibility: Lua 5.1, 5.2, 5.3, and Luajit.


Table of Contents


Why?

f.lua aims to be the most complete functional extension library for Lua, whilst remaining fundamentally Lua.

It's fast, safe, unsurprising and fully-featured, with let statements, string lambdas, and currying. Whether you miss LISP or Haskell whilst working with Lua, this should scratch your itch, without making Lua's VM come to a screeching halt.


Install

You can either copy the f.lua file whever you want it, or install via luarocks:

luarocks install f.lua

Usage

A brief look:

local f = require "f"

f.car(f.cons(2, f.cons(1)))
> 2

f.cdr(f.cons(2, f.cons(1)))
> {1}

f.fn("(x, y) return x, y")(1, 2)
> {1, 2}

f.let({x = 12}, function()
  print(x)
  f.let({x = 24}, function()
    print(x)
  end)
end)
print(x)
> 12
> 24
> nil

Refer to the documentation for more.


Semantic API

Semantic versioning is used to guarantee certain things. Whatever you find in the documentation is guaranteed.

Any breaking changes will increment the first number.

Any new features will be introduced with an increment to the second number.

Any bug fixes or cosmetic changes will be introduced with an increment to the third number.


License

See LICENSE.