diff options
author | Juraj Petráš <jurajpetras@Jurajs-MacBook-Pro-3.local> | 2024-06-10 18:54:07 +0200 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2024-06-15 13:52:21 +0100 |
commit | 78d1a06c9d8d5923960424fc0dfdb26cdfedfa77 (patch) | |
tree | f7742a8fd809e637edaee451c3bd275f85ad9f1b | |
parent | dd5b4103303786785bff85700bda368e362122fb (diff) | |
download | gleam_stdlib-78d1a06c9d8d5923960424fc0dfdb26cdfedfa77.tar.gz gleam_stdlib-78d1a06c9d8d5923960424fc0dfdb26cdfedfa77.zip |
Don't wait for next value in iterator.yield
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | src/gleam/iterator.gleam | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 11627a1..1991ba1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ - The `update` function of the `dict` module has been deprecated in favour of `upsert` and `update` will be used with a different signature in future. - The behaviour of the string trim functions is now consistent across targets. +- `iterator.yield` now yields values without waiting for the next one to become + available. ## v0.38.0 - 2024-05-24 diff --git a/src/gleam/iterator.gleam b/src/gleam/iterator.gleam index e4d572a..ad655c4 100644 --- a/src/gleam/iterator.gleam +++ b/src/gleam/iterator.gleam @@ -1617,5 +1617,5 @@ pub fn each(over iterator: Iterator(a), with f: fn(a) -> b) -> Nil { /// ``` /// pub fn yield(element: a, next: fn() -> Iterator(a)) -> Iterator(a) { - Iterator(fn() { Continue(element, next().continuation) }) + Iterator(fn() { Continue(element, fn() { next().continuation() }) }) } |