Registry provides
Registry.select/2 as an abstraction on top of `
:ets.select/2` to select key, pid, and values using match specs.
In one project we have a potential use case where we would like to only "select_count".
Registry.count_match/4 doesn't work for us, as it only matches on values under given key, while in our case we want to match on values under any key.
Surely we can first get the list and then count items in it, but that won't be as nice as directly using
:ets.select_count/2 Here I put up together a version that does the same as `Registry.select/2` but uses `:ets.select_count` underneath.
However, since match spec for "select_count" always assumes the third element to be `[true]` we could, probably only require the pattern and optional guards. Similar to the specs of
Registry.count_match/4