{"id":18789083,"url":"https://github.com/prncss-xyz/flua","last_synced_at":"2025-12-25T23:30:11.731Z","repository":{"id":45667531,"uuid":"477129313","full_name":"prncss-xyz/flua","owner":"prncss-xyz","description":"iterator composition in lua","archived":false,"fork":false,"pushed_at":"2024-02-22T19:47:31.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-29T14:34:18.648Z","etag":null,"topics":["functional-programming","iterators","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/prncss-xyz.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":"2022-04-02T17:46:14.000Z","updated_at":"2024-01-19T18:00:54.000Z","dependencies_parsed_at":"2024-01-19T18:28:44.422Z","dependency_job_id":"2dad1dc8-db1c-4c87-a01b-5a68386b26af","html_url":"https://github.com/prncss-xyz/flua","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prncss-xyz%2Fflua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prncss-xyz%2Fflua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prncss-xyz%2Fflua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prncss-xyz%2Fflua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prncss-xyz","download_url":"https://codeload.github.com/prncss-xyz/flua/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239709141,"owners_count":19684203,"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","iterators","lua"],"created_at":"2024-11-07T21:06:37.734Z","updated_at":"2025-12-25T23:30:11.654Z","avatar_url":"https://github.com/prncss-xyz.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flua ![lua](https://img.shields.io/badge/Lua-2C2D72?style=for-the-badge\u0026logo=lua\u0026logoColor=white) [![codecov](https://codecov.io/github/prncss-xyz/flua/graph/badge.svg?token=6E4BXIU81Q)](https://codecov.io/github/prncss-xyz/flua)\n\nLua is a minimalist language where [iterators](https://www.lua.org/pil/7.1.html) are an important concept. Flua is a small library to compose lua iterators in a functional style.\n\nMain motivation for this library was to allow monadic operations (`chain`, `flatten`), which are not supported by [luafun](https://github.com/luafun/luafun).\n\nIterators can return multiple values. Most of this library thrives to manage these values on the stack (to the cost of slightly less readable code). However, there are a few cases where it cannot be done. In those cases we provide a generic method (e.g. `last`) that uses the heap, and fix argument methods (e.g. `last1`, `last3`) which use the stack (and are hence faster). It is also the case for functions `scan` and `fold`. `zip` also suffers the same inconvenient (for the first argument only) and we might provide an equivalent method if we ever meet the need it.\n\nThe library targets lua jit (fork of lua 5.1) and do not work with lua 5.4 or later.\n\nCode is somewhat convoluted as it handles varags without creating tables, using lua specificities to handle the situation purely on stack instead of using heap allocation.\n\nDefinition of functions are given in comments, but we use names which are pretty standard amongst similar libraries.\n\n## Quick example\n\n```lua\n\nlocal f = require \"flua\"\n\nlocal function cb(n)\n  return f.range(n)\nend\n\nlocal res =  f.compose(f.chain(cb), f.to_list())(f.range(3))\n-- { 1, 1, 2, 1, 2, 3 }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprncss-xyz%2Fflua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprncss-xyz%2Fflua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprncss-xyz%2Fflua/lists"}