{"id":22016478,"url":"https://github.com/yonaba/moses","last_synced_at":"2025-04-04T18:05:30.291Z","repository":{"id":4059742,"uuid":"5163180","full_name":"Yonaba/Moses","owner":"Yonaba","description":"Utility library for functional programming  in Lua","archived":false,"fork":false,"pushed_at":"2019-12-18T02:39:18.000Z","size":1442,"stargazers_count":637,"open_issues_count":5,"forks_count":104,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-03-28T17:06:17.431Z","etag":null,"topics":["array","collection","functional","functional-programming","lua","object","table","underscore"],"latest_commit_sha":null,"homepage":"http://yonaba.github.io/Moses","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Yonaba.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-07-24T08:42:19.000Z","updated_at":"2025-03-22T18:22:36.000Z","dependencies_parsed_at":"2022-09-25T03:41:19.541Z","dependency_job_id":null,"html_url":"https://github.com/Yonaba/Moses","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yonaba%2FMoses","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yonaba%2FMoses/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yonaba%2FMoses/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yonaba%2FMoses/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yonaba","download_url":"https://codeload.github.com/Yonaba/Moses/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226213,"owners_count":20904465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["array","collection","functional","functional-programming","lua","object","table","underscore"],"created_at":"2024-11-30T04:35:28.242Z","updated_at":"2025-04-04T18:05:30.269Z","avatar_url":"https://github.com/Yonaba.png","language":"Lua","readme":"[![Build Status](https://travis-ci.org/Yonaba/Moses.png)](https://travis-ci.org/Yonaba/Moses)\n[![Latest Stable](https://img.shields.io/badge/Latest_Stable-2.1.0-blue.svg)](https://github.com/Yonaba/Moses/releases/tag/Moses-2.1.0-1)\n[![License](http://img.shields.io/badge/Licence-MIT-brightgreen.svg)](LICENSE)\n[![Lua](https://img.shields.io/badge/Lua-5.1%2C%205.2%2C%205.3%2C%20JIT-blue.svg)]()\n\nA Lua utility-belt library for [functional programming](http://en.wikipedia.org/wiki/Functional_programming).\u003cbr/\u003e\n\n## Examples\n\nHow can I get the sum of all integers between 1 and 100 ?\n\n```lua\nlocal sum = M.sum(M.range(100))\nprint(sum) -- 5050\n````\nSay I am looking for the length of the longest word in some array ?\n\n```lua\nlocal words = {'some','words','of','different','lengths'}\nprint(M.max(words, M.op.length)) -- 9 letters\n````\n\nWhat is the sum of all fibonacci numbers for n below or equal 25 ?\n\n```lua\nlocal function fib(n) return n \u003c 2 and n or fib(n - 1) + fib(n - 2) end\nlocal fibsum = M.sum(M.map(M.range(25), fib))\nprint(fibsum) -- 196417\n````\n\nOr let us do the same, object-oriented style with chaining :\n\n```lua\nlocal function fib(n) return n \u003c 2 and n or fib(n - 1) + fib(n - 2) end\nlocal fibsum = M.chain(M.range(25)):map(fib):sum():value()\nprint(fibsum) -- 196417\n````\n\nOr even shorter :\n\n```lua\nlocal fibsum = M(M.range(25)):map(fib):sum():value()\nprint(fibsum) -- 196417\n````\n\nFeel free to download and try it on your own!\n\n## Download\n\n### Archive\n* __2.1.0__ *(latest stable)*: [zip](http://github.com/Yonaba/Moses/archive/Moses-2.1.0-1.zip) | [tar.gz](http://github.com/Yonaba/Moses/archive/Moses-2.1.0-1.tar.gz) \n* __Previous versions__ : [tags](http://github.com/Yonaba/Moses/tags)\n\n### Bash\n\n```bash\ngit clone git://github.com/Yonaba/Moses.git\n````\n\n### LuaRocks\n\n````\nluarocks install moses\n````\n\n### MoonRocks\n\n````\nmoonrocks install moses\n````\n\n## Usage\n\n```lua\nlocal M = require \"moses\"\n````\n\n*Note:* the full source [moses.lua](https://github.com/Yonaba/Moses/blob/master/moses.lua) is quite heavy (~92 kiB, 3115 LOC). You can alternatively use the [minified version](https://github.com/Yonaba/Moses/blob/master/moses_min.lua) (~35 kiB, 561 LOC).\n\n## Tutorial\n\nFind a complete set of code examples in [tutorial.md](https://github.com/Yonaba/Moses/blob/master/doc/tutorial.md).\n  \n## Documentation\n\n* Read it [online](http://yonaba.github.io/Moses/doc).\n\n## Credits and Acknowledgement\n\n* [Jeremy Ashkenas](https://github.com/jashkenas), for the amazing [Underscore.js](http://documentcloud.github.com/underscore/)\n* [Marcus Irven](http://mirven.github.com/underscore.lua/)'s and [JT Archie](https://github.com/jtarchie/underscore-lua)'s 1-to-1 ports that also inspired this\n* [Matthew Rocklin](https://github.com/mrocklin)'s [Toolz](https://github.com/pytoolz/toolz/) from which I borrowed some ideas\n* [Steve Donovan](https://github.com/stevedonovan)'s [LDoc](https://github.com/stevedonovan/ldoc/), used to generate the current HTML documentation.\n* [Mark Langen](https://github.com/stravant)'s [LuaMinify](https://github.com/stravant/LuaMinify/), used to generate a minified version of this library.\n\n## Specification\n\nRun [spec tests](https://github.com/Yonaba/Moses/blob/master/spec) from Lua using [busted](https://github.com/Olivine-Labs/busted/) with the following command from the root folder:\n\n````\nbusted\n````\n\n## License\n\nThis work is under [MIT-LICENSE](http://www.opensource.org/licenses/mit-license.php)\u003cbr/\u003e\nCopyright (c) 2012-2018 Roland Yonaba. \u003cbr/\u003e\nSee [LICENSE](LICENSE).\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyonaba%2Fmoses","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyonaba%2Fmoses","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyonaba%2Fmoses/lists"}