{"id":24405249,"url":"https://github.com/iagoleal/lazy-streams","last_synced_at":"2025-08-16T12:13:36.349Z","repository":{"id":77422951,"uuid":"354458853","full_name":"iagoleal/lazy-streams","owner":"iagoleal","description":"Lazy (possibly) infinite linked lists in Lua","archived":false,"fork":false,"pushed_at":"2021-04-24T19:45:07.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-13T08:13:40.903Z","etag":null,"topics":["data-structure","lua","streams"],"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/iagoleal.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":"2021-04-04T04:54:20.000Z","updated_at":"2022-07-23T14:36:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"88297762-7e40-40a6-95fa-e6aad1f9f431","html_url":"https://github.com/iagoleal/lazy-streams","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iagoleal/lazy-streams","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iagoleal%2Flazy-streams","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iagoleal%2Flazy-streams/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iagoleal%2Flazy-streams/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iagoleal%2Flazy-streams/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iagoleal","download_url":"https://codeload.github.com/iagoleal/lazy-streams/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iagoleal%2Flazy-streams/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270709037,"owners_count":24631992,"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","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["data-structure","lua","streams"],"created_at":"2025-01-20T04:41:09.592Z","updated_at":"2025-08-16T12:13:36.325Z","avatar_url":"https://github.com/iagoleal.png","language":"Lua","readme":"# Lazy Streams in Lua\n\n| **Build Status** |\n|:----------------:|\n| [![Build Status][build-img]][build-url] |\n\nA Lua library to manipulate lazy linked lists.\nHighly based on Haskell's list type.\n\n\n## Usage Examples\n\nTo calculate all Fibonacci number, you can do:\n\n```lua\ns = require(\"lazy-streams\")\n\nlocal add = function(x,y)\n  return x+y\nend\n\n-- Stream of all Fibonacci numbers\nlocal fibs = s.cons(0, s.new(1, function()\n  return s.map(add, fibs, fibs:tail())\n  end))\n```\n\nTo calculate all prime numbers,\nyou can do an infinite sieve of Eratosthenes:\n\n```lua\ns = require(\"lazy-streams\")\n\n-- Make a non-divisibility test\nfunction notDivisible(p)\n  return function(x)\n    return math.fmod(x,p) ~= 0\n  end\nend\n\n-- Sieve of Eratosthenes\nfunction sieve(stream)\n  local p = stream:head()\n  return s.new(p, function()\n    return era(stream:tail():filter(notDivisible(p)))\n  end)\nend\n\n-- Stream of all prime numbers\nlocal primes = sieve(s.range(2))\n```\n\n[build-img]: https://github.com/iagoleal/lazy-streams/actions/workflows/ci.yml/badge.svg?branch=master\n[build-url]: https://github.com/iagoleal/lazy-streams/actions/workflows/ci.yml\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiagoleal%2Flazy-streams","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiagoleal%2Flazy-streams","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiagoleal%2Flazy-streams/lists"}