diff options
author | Julian Schurhammer <julian.schurhammer@gmail.com> | 2023-12-08 10:06:47 +1300 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2023-12-09 09:57:32 +0000 |
commit | d07f9640a0157f5f661eb2908147605ea339fbff (patch) | |
tree | 8681c77c86c9b5ba3b3994b6ef61c7c54bf13064 /src | |
parent | eaa795fe6597f8bd9b8b95045f293ff5e81dd96d (diff) | |
download | gleam_stdlib-d07f9640a0157f5f661eb2908147605ea339fbff.tar.gz gleam_stdlib-d07f9640a0157f5f661eb2908147605ea339fbff.zip |
iterator.index: change to #(a, Int)
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam/iterator.gleam | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gleam/iterator.gleam b/src/gleam/iterator.gleam index c57e7fd..c41a3c2 100644 --- a/src/gleam/iterator.gleam +++ b/src/gleam/iterator.gleam @@ -689,12 +689,12 @@ pub fn find( fn do_index( continuation: fn() -> Action(element), next: Int, -) -> fn() -> Action(#(Int, element)) { +) -> fn() -> Action(#(element, Int)) { fn() { case continuation() { Stop -> Stop Continue(e, continuation) -> - Continue(#(next, e), do_index(continuation, next + 1)) + Continue(#(e, next), do_index(continuation, next + 1)) } } } @@ -705,10 +705,10 @@ fn do_index( /// /// ```gleam /// > from_list(["a", "b", "c"]) |> index |> to_list -/// [#(0, "a"), #(1, "b"), #(2, "c")] +/// [#("a", 0), #("b", 1), #("c", 2)] /// ``` /// -pub fn index(over iterator: Iterator(element)) -> Iterator(#(Int, element)) { +pub fn index(over iterator: Iterator(element)) -> Iterator(#(element, Int)) { iterator.continuation |> do_index(0) |> Iterator |