diff options
Diffstat (limited to 'aoc-2020-gleam/src/ext/listx.gleam')
-rw-r--r-- | aoc-2020-gleam/src/ext/listx.gleam | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/aoc-2020-gleam/src/ext/listx.gleam b/aoc-2020-gleam/src/ext/listx.gleam new file mode 100644 index 0000000..d962515 --- /dev/null +++ b/aoc-2020-gleam/src/ext/listx.gleam @@ -0,0 +1,7 @@ +import gleam/list + +pub fn count(list: List(a), satisfying predicate: fn(a) -> Bool) -> Int { + list + |> list.filter(for: predicate) + |> list.length +} |