diff options
Diffstat (limited to 'aoc-2020-gleam/src/ext/iteratorx.gleam')
-rw-r--r-- | aoc-2020-gleam/src/ext/iteratorx.gleam | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/aoc-2020-gleam/src/ext/iteratorx.gleam b/aoc-2020-gleam/src/ext/iteratorx.gleam index 6c7838d..93136be 100644 --- a/aoc-2020-gleam/src/ext/iteratorx.gleam +++ b/aoc-2020-gleam/src/ext/iteratorx.gleam @@ -3,15 +3,10 @@ import gleam/result as res import gleam/dict.{type Dict} import gleam/iterator.{type Iterator, Next} as iter -pub fn length(iterator: Iterator(a)) -> Int { - iterator - |> iter.fold(from: 0, with: fn(c, _) { c + 1 }) -} - pub fn count(iterator: Iterator(a), satisfying predicate: fn(a) -> Bool) -> Int { iterator |> iter.filter(keeping: predicate) - |> length + |> iter.length } pub fn counts(iterator: Iterator(a)) -> Dict(a, Int) { |