{"id":19475412,"url":"https://github.com/erdian718/stream","last_synced_at":"2026-04-15T23:33:01.764Z","repository":{"id":144205533,"uuid":"184236618","full_name":"erdian718/stream","owner":"erdian718","description":"A simple lazy list module for Lua.","archived":false,"fork":false,"pushed_at":"2019-06-30T14:02:30.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-18T23:02:22.574Z","etag":null,"topics":["go","lazy-evaluation","lua","stream"],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erdian718.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}},"created_at":"2019-04-30T09:51:06.000Z","updated_at":"2021-11-23T08:58:22.000Z","dependencies_parsed_at":"2023-06-19T13:48:26.583Z","dependency_job_id":null,"html_url":"https://github.com/erdian718/stream","commit_stats":null,"previous_names":["erdian718/stream"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/erdian718/stream","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdian718%2Fstream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdian718%2Fstream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdian718%2Fstream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdian718%2Fstream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erdian718","download_url":"https://codeload.github.com/erdian718/stream/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdian718%2Fstream/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31865067,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["go","lazy-evaluation","lua","stream"],"created_at":"2024-11-10T19:32:39.906Z","updated_at":"2026-04-15T23:33:01.737Z","avatar_url":"https://github.com/erdian718.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stream\n\nA simple lazy list module for [Lua](https://github.com/ofunc/lua).\n\n## Usage\n\n```lua\nlocal stream = require 'stream'\n\n-- Define a Fibonacci sequence.\nlocal fibs\nfibs = stream.cons(0, stream.new(1, function()\n\treturn stream.zip(fibs, fibs.tail):map(function(x)\n\t\treturn x[1] + x[2]\n\tend)\nend))\n-- Take the first 32 elements and print them.\nfibs:take(32):walk(print)\n```\n\nMore examples refer to tests.\n\n## Dependencies\n\n* [ofunc/lua](https://github.com/ofunc/lua)\n\n## Documentation\n\n### stream.new(head, tail)\n\nCreates a stream with `head` and `tail`.\n`tail` must be a function that generates the tail of this stream.\n\n### stream.cons(x, s)\n\nPrepends the element `x` to the head of the stream `s`.\n\n### stream.make(f, x, i)\n\nCreates a stream using the iteration function `f`. `x` and `i` is the arguments of `f`.\n\n### stream.zip(...)\n\nReturns a stream of tables, where the i-th table contains the i-th element from each of the argument streams.\nThe returned stream is truncated in length to the length of the shortest argument stream.\n\n### stream.duplicate(x)\n\nCreates an infinite stream with all its elements are `x`.\n\n### stream.sequence(i)\n\nCreates an infinite incremental sequence starting with `i`.\n\n### stream:all(f)\n\nReturns whether all elements of the stream match the given `f` function.\n\n### stream:any(f)\n\nReturns whether any element of the stream matches the given `f` function.\n\n### stream:fold(a, f)\n\nApplies the `f` function to each element of the stream, threading an accumulator argument `a` through the computation. \n\n### stream:force()\n\nCalculates the elements of the stream immediately, no lazy.\n\n### stream:walk(f)\n\nApplies the given `f` function to each element of the stream.\n\n### stream:map(f)\n\nApplies the given `f` function to each element of the stream and returns the stream.\n\n### stream:filter(f)\n\nFilters the elements of the stream to match the given `f` function and returns the stream.\n\n### stream:take(x)\n\nIf `x` is a integer, then takes the first `x` elements.\nIf `x` is a function, then takes all elements of the stream as long as `x` is true.\n\n### stream:drop(x)\n\nIf `x` is a integer, then rejects the first `x` elements.\nIf `x` is a function, then rejects all elements of the stream as long as `x` is true.\n\n### stream:cut(x)\n\nIf `x` is a integer, then rejects the last `x` elements.\nIf `x` is a function, then rejects all elements of the stream (start with the last one) as long as `x` is true.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferdian718%2Fstream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferdian718%2Fstream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferdian718%2Fstream/lists"}