All Projects → luafun → Luafun

luafun / Luafun

Licence: other
Lua Fun is a high-performance functional programming library for Lua designed with LuaJIT's trace compiler in mind.

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to Luafun

lcurses
Lua bindings for Curses
Stars: ✭ 60 (-96.37%)
Mutual labels:  luajit, luarocks
Luarocks
LuaRocks is the package manager for the Lua programming language.
Stars: ✭ 2,324 (+40.51%)
Mutual labels:  luajit, luarocks
sqlite.lua
SQLite LuaJIT binding with a very simple api.
Stars: ✭ 291 (-82.41%)
Mutual labels:  luajit, luarocks
strict
Check for use of undeclared variables
Stars: ✭ 32 (-98.07%)
Mutual labels:  luajit, luarocks
ljdns
A contemporary DNS library using LuaJIT FFI.
Stars: ✭ 26 (-98.43%)
Mutual labels:  luajit, luarocks
Articles
thoughts on programming
Stars: ✭ 1,515 (-8.4%)
Mutual labels:  functional-programming
Luakit
Fast, small, webkit based browser framework extensible by Lua.
Stars: ✭ 1,640 (-0.85%)
Mutual labels:  luajit
Functional Way
Write small programs (eg -algorithms) in a functional way.
Stars: ✭ 115 (-93.05%)
Mutual labels:  functional-programming
Kind
A modern proof language
Stars: ✭ 2,075 (+25.45%)
Mutual labels:  functional-programming
Lightweight Stream Api
Stream API from Java 8 rewritten on iterators for Java 7 and below
Stars: ✭ 1,582 (-4.35%)
Mutual labels:  functional-programming
Reactive Turtle
Scala and Akka for kids. A Functional Programming approach for the well known LOGO.
Stars: ✭ 122 (-92.62%)
Mutual labels:  functional-programming
Aardvark.base
Aardvark is an open-source platform for visual computing, real-time graphics and visualization. This repository is the basis for most platform libraries and provides basic functionality such as data-structures, math and much more.
Stars: ✭ 117 (-92.93%)
Mutual labels:  functional-programming
Pointless
Pointless: a scripting language for learning and fun
Stars: ✭ 116 (-92.99%)
Mutual labels:  functional-programming
Test State
Scala Test-State.
Stars: ✭ 119 (-92.81%)
Mutual labels:  functional-programming
Dunai
Classic and Arrowized Functional Reactive Programming, Reactive Programming, and Stream programming, all via Monadic Stream Functions
Stars: ✭ 115 (-93.05%)
Mutual labels:  functional-programming
Ghc Grin
GRIN backend for GHC
Stars: ✭ 123 (-92.56%)
Mutual labels:  functional-programming
Cilib
Typesafe, purely functional Computational Intelligence
Stars: ✭ 114 (-93.11%)
Mutual labels:  functional-programming
Awesome Functional Python
A curated list of awesome things related to functional programming in Python.
Stars: ✭ 1,637 (-1.03%)
Mutual labels:  functional-programming
Lambda Lantern
🧙 ‎‎ A 3D game about functional programming patterns. Uses PureScript Native, C++, and Panda3D.
Stars: ✭ 122 (-92.62%)
Mutual labels:  functional-programming
Motan Openresty
A cross-language RPC framework for rapid development of high performance distributed services based on OpenResty.
Stars: ✭ 117 (-92.93%)
Mutual labels:  luajit

Lua Functional

Lua Fun is a high-performance functional programming library for Lua designed with LuaJIT's trace compiler in mind.

Lua Fun provides a set of more than 50 programming primitives typically found in languages like Standard ML, Haskell, Erlang, JavaScript, Python and even Lisp. High-order functions such as map, filter, reduce, zip, etc., make it easy to write simple and efficient functional code.

Let's see an example:

> -- Functional style
> require "fun" ()
> -- calculate sum(x for x^2 in 1..n)
> n = 100
> print(reduce(operator.add, 0, map(function(x) return x^2 end, range(n))))
328350

> -- Object-oriented style
> local fun = require "fun"
> -- calculate sum(x for x^2 in 1..n)
> print(fun.range(n):map(function(x) return x^2 end):reduce(operator.add, 0))
328350

Lua Fun takes full advantage of the innovative tracing JIT compiler to achieve transcendental performance on nested functional expressions. Functional compositions and high-order functions can be translated into efficient machine code. Can you believe it? Just try to run the example above with luajit -jdump and see what happens:

-- skip some initilization code --
->LOOP:
0bcaffd0  movaps xmm5, xmm7
0bcaffd3  movaps xmm7, xmm1
0bcaffd6  addsd xmm7, xmm5
0bcaffda  ucomisd xmm7, xmm0
0bcaffde  jnb 0x0bca0024        ->5
0bcaffe4  movaps xmm5, xmm7
0bcaffe7  mulsd xmm5, xmm5
0bcaffeb  addsd xmm6, xmm5
0bcaffef  jmp 0x0bcaffd0        ->LOOP
---- TRACE 1 stop -> loop

The functional chain above was translated by LuaJIT to (!) one machine loop containing just 10 CPU assembly instructions without CALL. Unbelievable!

Readable? Efficient? Can your Python/Ruby/V8 do better?

Status

Lua Fun is in an early alpha stage. The library fully documented and covered with unit tests.

Build Status

LuaJIT 2.1 alpha is recommended. The library designed in mind of fact that LuaJIT traces tail-, up- and down-recursion and has a lot of byte code optimizations. Lua 5.1-5.3 are also supported.

This is master (development) branch. API may be changed without any special notice. Please use stable branch for your production deployments. If you still want to use master, please don't forget to grep git log for Incompatible API changes message. Thanks!

Please check out documentation for more information.

Misc

Lua Fun is distributed under the MIT/X11 License - (same as Lua and LuaJIT).

The library was written to use with Tarantool - an efficient in-memory store and an asynchronous Lua application server.

See Also

Please "Star" the project on GitHub to help it to survive! Thanks!


Lua Fun. Simple, Efficient and Functional. In Lua. With JIT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].