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

Already on GitHub? Sign in to your account

List.sum fails on empty list #519

c-cube opened this Issue Jan 21, 2014 · 8 comments


None yet
3 participants

c-cube commented Jan 21, 2014

Strangely, List.sum fails on the empty list (instead of returning 0), but Enum.sum returns 0 in this case (same for fsum).

I guess this will have to wait until 3.0, but still, it's strange.


gasche commented Jan 21, 2014

We should make a breaks-compat branch to integrate proposed changes for the next major version.


c-cube commented Jan 21, 2014

Good idea!


UnixJunkie commented Jan 22, 2014

0 is the neutral element of addition.
1 is the one for multiplication.
If you fix sum like this, you'll have to fix prod and fprod in the same way
so they return 1 or 1.0 instead of crashing.


c-cube commented Jan 22, 2014

indeed, that sounds right to me. Always return the neutral element for reduce, if we know it. Again to be solved for 3.0 ?


UnixJunkie commented Jan 23, 2014

I guess so (3.0) as it is a change in behaviour compared to previous versions.


UnixJunkie commented Apr 17, 2014

We should integrate this in a special branch.

@UnixJunkie UnixJunkie self-assigned this Apr 17, 2014


UnixJunkie commented Nov 6, 2015

Shouldn't this go in our upcoming release?


gasche commented Nov 6, 2015

I think we should keep it for the next major version push (3.0), because it breaks backward-compatibility. It is not a bugfix or a new feature, but something that improves consistency at the cost of changing a specified behavior.

You could decide to make the coming release a major release, but I suspect that it's a bit ambitious after our failure to get releases out in the past few month. I would be in favor of getting a release that is as polished and modest as reasonable now, to put a better release cycle on its rails, and later decide when we want our next major release and what to have in it -- for example some of @c-cube more ambitious inter-module dependency cuts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment