Yielder

A pure and lazy sequence data structure.

Package Version Hex Docs

You probably don’t want this package. This data structure was removed from the standard library due not being commonly useful, and projects using it when there was a better option.

Before using this library consider whether there is a better option for your project. e.g. A regular list, a function that takes state as an argument and returns a new state with the produced value, an actor that sends or receives a stream of messages, a side-effectful function that can be called repeatedly, etc.

You may want to use this library when you have a pure function that can generate a sequence of values but the sequence is too large to fit into memory, or it would be wasteful to do so. You could instead create a Yielder for it and only have the section you are working on in memory, and halt evaluation when you have consumed as much of the sequence as you need for your program. Even in this case, having a function that takes the previous state as an argument and returns the new state and any produced value in a tuple is typically a better option.

Documentation can be found at https://hexdocs.pm/gleam_yielder.

Search Document