diff options
Diffstat (limited to 'aoc-2020-gleam/src/ext/iteratorx.gleam')
-rw-r--r-- | aoc-2020-gleam/src/ext/iteratorx.gleam | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/aoc-2020-gleam/src/ext/iteratorx.gleam b/aoc-2020-gleam/src/ext/iteratorx.gleam index 456c1d1..8e34351 100644 --- a/aoc-2020-gleam/src/ext/iteratorx.gleam +++ b/aoc-2020-gleam/src/ext/iteratorx.gleam @@ -3,8 +3,7 @@ import gleam/list pub fn length(iterator: Iterator(a)) -> Int { iterator - |> iter.to_list - |> list.length + |> iter.fold(from: 0, with: fn(c, _) { c + 1 }) } pub fn count(iterator: Iterator(a), satisfying predicate: fn(a) -> Bool) -> Int { |