All Projects → Yonaba → Moses

Yonaba / Moses

Licence: mit
Utility library for functional programming in Lua

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to Moses

Morphism
⚡ Type-safe data transformer for JavaScript, TypeScript & Node.js.
Stars: ✭ 336 (-37.89%)
Mutual labels:  array, object, functional
Yalinqo
Yet Another LINQ to Objects for PHP [Simplified BSD]
Stars: ✭ 400 (-26.06%)
Mutual labels:  underscore, functional-programming, functional
js-deep-sort-object
Simple module to sort objects recursively by its keys
Stars: ✭ 19 (-96.49%)
Mutual labels:  collection, object, array
Eslint Plugin Functional
ESLint rules to disable mutation and promote fp in JavaScript and TypeScript.
Stars: ✭ 282 (-47.87%)
Mutual labels:  functional-programming, functional
array-mixer
Powerful, super tiny and easy to use lib to reorder your javascript arrays.
Stars: ✭ 32 (-94.09%)
Mutual labels:  functional, array
Kind Of
Get the native JavaScript type of a value, fast. Used by superstruct, micromatch and many others!
Stars: ✭ 268 (-50.46%)
Mutual labels:  array, object
Sequency
⚡️ Type-safe functional sequences for processing iterable data
Stars: ✭ 294 (-45.66%)
Mutual labels:  collection, functional
Coconut
Simple, elegant, Pythonic functional programming.
Stars: ✭ 3,422 (+532.53%)
Mutual labels:  functional-programming, functional
Underscore Java
java port of Underscore.js
Stars: ✭ 327 (-39.56%)
Mutual labels:  underscore, functional-programming
Kotlin Result
A multiplatform Result monad for modelling success or failure operations.
Stars: ✭ 369 (-31.79%)
Mutual labels:  functional-programming, functional
Nspl
Non-Standard PHP Library - functional primitives toolbox and more
Stars: ✭ 365 (-32.53%)
Mutual labels:  underscore, functional
Carp
Carp is a programming language designed to work well for interactive and performance sensitive use cases like games, sound synthesis and visualizations.
Stars: ✭ 4,389 (+711.28%)
Mutual labels:  functional-programming, functional
underscore.haz
🔍 _.haz() is like _.has() but this underscore and/or lodash mixin lets you do deep object key existence checking with a dot denoted string, for example 'a.b.c'
Stars: ✭ 13 (-97.6%)
Mutual labels:  object, underscore
ss-search
The most basic, yet powerful text search.
Stars: ✭ 41 (-92.42%)
Mutual labels:  object, array
Collection
A PHP library for representing and manipulating collections.
Stars: ✭ 488 (-9.8%)
Mutual labels:  array, collection
utils.js
👷 🔧 zero dependencies vanilla JavaScript utils.
Stars: ✭ 14 (-97.41%)
Mutual labels:  object, array
ustd
Micro-standard-library providing minimal and portable array, queue and map for attiny avr, arduinos, esp8266/32 and linux, mac
Stars: ✭ 14 (-97.41%)
Mutual labels:  functional, array
ExpandedCollectionBundle
Symfony bundle for render entity collections as a selectable expanded list.
Stars: ✭ 13 (-97.6%)
Mutual labels:  collection, table
rudash
Rudash - Lodash for Ruby Apps
Stars: ✭ 27 (-95.01%)
Mutual labels:  functional, underscore
Arrayy
🗃 Array manipulation library for PHP, called Arrayy!
Stars: ✭ 363 (-32.9%)
Mutual labels:  array, collection

Build Status Latest Stable License Lua

A Lua utility-belt library for functional programming.

Examples

How can I get the sum of all integers between 1 and 100 ?

local sum = M.sum(M.range(100))
print(sum) -- 5050

Say I am looking for the length of the longest word in some array ?

local words = {'some','words','of','different','lengths'}
print(M.max(words, M.op.length)) -- 9 letters

What is the sum of all fibonacci numbers for n below or equal 25 ?

local function fib(n) return n < 2 and n or fib(n - 1) + fib(n - 2) end
local fibsum = M.sum(M.map(M.range(25), fib))
print(fibsum) -- 196417

Or let us do the same, object-oriented style with chaining :

local function fib(n) return n < 2 and n or fib(n - 1) + fib(n - 2) end
local fibsum = M.chain(M.range(25)):map(fib):sum():value()
print(fibsum) -- 196417

Or even shorter :

local fibsum = M(M.range(25)):map(fib):sum():value()
print(fibsum) -- 196417

Feel free to download and try it on your own!

Download

Archive

Bash

git clone git://github.com/Yonaba/Moses.git

LuaRocks

luarocks install moses

MoonRocks

moonrocks install moses

Usage

local M = require "moses"

Note: the full source moses.lua is quite heavy (~92 kiB, 3115 LOC). You can alternatively use the minified version (~35 kiB, 561 LOC).

Tutorial

Find a complete set of code examples in tutorial.md.

Documentation

Credits and Acknowledgement

Specification

Run spec tests from Lua using busted with the following command from the root folder:

busted

License

This work is under MIT-LICENSE
Copyright (c) 2012-2018 Roland Yonaba.
See LICENSE.

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