aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gleam/iterator.gleam4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gleam/iterator.gleam b/src/gleam/iterator.gleam
index 4e5a752..6a16ad8 100644
--- a/src/gleam/iterator.gleam
+++ b/src/gleam/iterator.gleam
@@ -1440,3 +1440,7 @@ pub fn each(over iterator: Iterator(a), with f: fn(a) -> b) -> Nil {
|> map(f)
|> run
}
+
+pub fn yield(element: a, next: fn() -> Iterator(a)) -> Iterator(a) {
+ Iterator(fn() { Continue(element, next().continuation) })
+}