Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow count to function like sum #24

Open
nordfjord opened this issue Oct 4, 2015 · 3 comments
Open

Allow count to function like sum #24

nordfjord opened this issue Oct 4, 2015 · 3 comments

Comments

@nordfjord
Copy link
Contributor

Many times you get data from a server which has been pre-reduced in some way (e.g. already has a count)
In those cases it would be exceedingly valuable to allow count to simply sum those counts together.

Proposed api:

reductio().count(true); // p.count++;
reductio().count('items') // p.count += v.items;
@nordfjord
Copy link
Contributor Author

To be clear this is mainly about semantics, I find it weird to call reductio.sum when I'm aggregating counts.

@esjewett
Copy link
Member

esjewett commented Oct 5, 2015

I think we need to work on a general approach to this. See the list I've started at the end of https://github.com/esjewett/reductio/blob/master/NOTES.md. My thinking right now is a whole separate set of reducers for pre-aggregated data.

@tannerlinsley
Copy link
Contributor

This would be easy with alias-able property names like #35, you could easily just alias the sum aggregation as the count property

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants