From 35d5c737e0e1d4c32ec96034dacdcc8303c6caf7 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 13 Jan 2021 22:33:58 +1100 Subject: Rename helper function to do_index_fold --- src/gleam/list.gleam | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gleam/list.gleam b/src/gleam/list.gleam index 32d6675..9db8967 100644 --- a/src/gleam/list.gleam +++ b/src/gleam/list.gleam @@ -454,11 +454,11 @@ pub fn fold_right(list: List(a), from initial: b, with fun: fn(a, b) -> b) -> b } } -fn index_fold_(over: List(a), acc: b, with: fn(Int, a, b) -> b, index: Int) -> b { +fn do_index_fold(over: List(a), acc: b, with: fn(Int, a, b) -> b, index: Int) -> b { case over { [] -> acc [first, ..rest] -> - index_fold_(rest, with(index, first, acc), with, index + 1) + do_index_fold(rest, with(index, first, acc), with, index + 1) } } @@ -476,7 +476,7 @@ pub fn index_fold( from initial: b, with fun: fn(Int, a, b) -> b, ) -> b { - index_fold_(over, initial, fun, 0) + do_index_fold(over, initial, fun, 0) } /// A variant of fold that might fail. -- cgit v1.2.3