Add a list.count function
Quantumplation opened this issue · comments
Description
Add a list.count function that counts the number of items that match a predicate.
Motivation
You can achieve the same thing with foldl, but it's far more ergonomic to do something like
required <= list.count(scripts, fn(s) { satisfied(s, signatories, validRange) })
vs
required <= list.foldl(scripts, fn(i,t) { if satisfied(s, signatories, validRange) { t + 1 } else { t } }, 0}
Are you willing to submit a PR?
Yes, one coming in just a few minutes :)
(There's no CONTRIBUTING.md, so I wasn't sure whether to open a ticket first or not, and decided to err on the side of caution)