Infinitely unfold values on-demand from a function
Find a file
2025-08-09 18:41:29 +10:00
.github/workflows Initial commit 2025-08-09 18:40:17 +10:00
src Initial commit 2025-08-09 18:40:17 +10:00
test Initial commit 2025-08-09 18:40:17 +10:00
.gitignore Initial commit 2025-08-09 18:40:17 +10:00
gleam.toml Initial commit 2025-08-09 18:40:17 +10:00
manifest.toml Initial commit 2025-08-09 18:40:17 +10:00
README.md Update README.md 2025-08-09 18:41:29 +10:00

infiniyield

Infinitely unfold values on-demand from a function

Package Version Hex Docs

gleam add infiniyield@1
import infiniyield

pub fn main() {
  infiniyield.unfold(2, fn(acc) { yielder.Next(acc, acc * 2) })
  |> infiniyield.take(5)
  // -> [2, 4, 8, 16, 32]
}

Further documentation can be found at https://hexdocs.pm/infiniyield.

Development

gleam run   # Run the project
gleam test  # Run the tests