aboutsummaryrefslogtreecommitdiff
path: root/aoc-2020-gleam/src/ext/setx.gleam
blob: 33ebbc39f584f78f8d5e817b3f49338743c9e463 (plain)
1
2
3
4
5
6
7
8
9
10
import gleam/set.{type Set}
import gleam/iterator as iter
import ext/iteratorx as iterx

pub fn count(set: Set(a), satisfying predicate: fn(a) -> Bool) -> Int {
  set
  |> set.to_list
  |> iter.from_list
  |> iterx.count(satisfying: predicate)
}