-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add count
#140
Comments
I think I'm against adding this. AFAIK, most common Foldable types (e.g. Feel free to disagree with me, but I'll close this for now. |
Perhaps because I'm a noob to PS (and to FP in general), I'm going to disagree, so I might just need to be enlightened. I'm all ears if my argument isn't valid. The difference in what I'm proposing is the use of a predicate, distinguishing the proposed In essence, Again, I'm all ears if what I'm proposing doesn't make sense, or if there is some other way to achieve this that I'm not aware of, without having to implement my own As you said, however, this really is simple to define in local usages, so perhaps this is reason enough to avoid adding the proposed No worries if you still disagree. I appreciate your time and consideration, and look forward to deepening my PS and FP knowledge. |
I think the proposed |
Most of my argument comes from the principle of not being quick to add things to core libraries and whether something simple like this passes the Fairbairn Threshold. If something was added, but the API wasn't quite right, then we have to fix it via a breaking change, which doesn't happen very often, so we're stuck with the design for a while. Clearly, this definition isn't liable to such a problem because that's the only way it can be defined. Since Gary is good with this addition, then I'll remove my stance against this. |
Well, now you mention it... I suppose it could be defined with |
Yeah, I don't think anyone would be using anything aside from |
We do use We use |
I'd like to suggest adding a
count
function to count the number of elements that match a predicate.Perhaps something like so:
The text was updated successfully, but these errors were encountered: