From d07f9640a0157f5f661eb2908147605ea339fbff Mon Sep 17 00:00:00 2001 From: Julian Schurhammer Date: Fri, 8 Dec 2023 10:06:47 +1300 Subject: iterator.index: change to #(a, Int) --- src/gleam/iterator.gleam | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') 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 -- cgit v1.2.3