{"id":17103013,"url":"https://github.com/helpermethod/lamda","last_synced_at":"2025-04-13T00:41:50.334Z","repository":{"id":146262521,"uuid":"147692954","full_name":"helpermethod/lamda","owner":"helpermethod","description":"A functional programming library for Lua, inspired by Ramda.","archived":false,"fork":false,"pushed_at":"2018-12-26T08:36:18.000Z","size":46,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T18:43:51.215Z","etag":null,"topics":["functional-programming","lua"],"latest_commit_sha":null,"homepage":"","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/helpermethod.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-06T15:15:24.000Z","updated_at":"2021-08-13T09:07:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"c95c7e7c-140b-4552-9d3c-229e81c5be6d","html_url":"https://github.com/helpermethod/lamda","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpermethod%2Flamda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpermethod%2Flamda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpermethod%2Flamda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helpermethod%2Flamda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helpermethod","download_url":"https://codeload.github.com/helpermethod/lamda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650417,"owners_count":21139672,"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":["functional-programming","lua"],"created_at":"2024-10-14T15:31:04.312Z","updated_at":"2025-04-13T00:41:50.329Z","avatar_url":"https://github.com/helpermethod.png","language":"Lua","readme":"# lamda\n\n[![CircleCI](https://circleci.com/gh/helpermethod/lamda.svg?style=svg)](https://circleci.com/gh/helpermethod/lamda)\n[![Coverage Status](https://coveralls.io/repos/github/helpermethod/lamda/badge.svg?branch=master)](https://coveralls.io/github/helpermethod/lamda?branch=master)\n\nA functional programming library for Lua, inspired by [Ramda](https://ramdajs.com/).\n\n## Install\n\n```sh\n$ luarocks install lamda\n```\n\n## Usage\n\n```lua\nlocal lamda = require('lamda')\n\nlocal shout = lamda.pipe(string.upper, function(s) return s .. '!' end)\n\nshout('lamda rocks') -- returns 'LAMDA ROCKS!'\n```\n\n## API\n\n### flip(fn)\n\nCreates a new function with the order of the first two arguments reversed.\n\n```lua\nlocal join = lamda.flip(table.concat)\n\njoin(',', {1, 2, 3}) -- returns '1,2,3'\n```\n\n### join(separator, tbl)\n\nCreates a new string by concatenating all elemements and putting a separator in between.\n\n```lua\nlamda.join(',', {1, 2, 3}) -- returns '1,2,3'\n```\n\n### concat(first_table, second_table)\n\nCreates a new array by concatenating the given arrays.\n\n```lua\nlamda.concat({1, 2, 3}, {4, 5, 6}) -- returns {1, 2, 3, 4, 5, 6}\n```\n\n### pipe(fn, ...)\n\nCreates a new function by composing the given functions from left to right. The first function may have any arity while the remaining functions must be unary.\n\n```lua\nlocal function add(a, b)\n  return a + b\nend\n\nlocal function square(n)\n  return n ^ 2\nend\n\nlocal add_and_square = lamda.pipe(add, square)\n\nadd_and_square(2, 3) -- returns 25\n```\n\n### partial(fn, ...)\n\nTakes a function `f` and a variable number of arguments and creates a new function `g`. When applied, `g` returns the result of applying `f` to theinitially provided arguments followed by the arguments to `g`.\n\n```lua\nlocal function prepend(first_string, second_string)\n  return\nend\n\nlocal add_two = lamda.partial(add, 2)\n```\n\n### partial_right(fn, ...)\n\n### any_pass(predicate, ...)\n\n### sort(comparator, tbl)\n\nCreates a new array by sorting the given array according to a comparator function. The comparator function receives two arguments and must return `true` if the first argument should come first in the sorted array.\n\n```lua\nlocal numbers = {2, 1, 3}\n\nlamda.sort(function(a, b) return a \u003c b end, numbers) -- returns {1, 2, 3}\n```\n","funding_links":[],"categories":["Resources"],"sub_categories":["Programming Paradigms"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelpermethod%2Flamda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelpermethod%2Flamda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelpermethod%2Flamda/lists"}