On Wednesday, 3 February 2016 at 21:45:04 UTC, Timon Gehr wrote:
On 02/03/2016 09:12 PM, Atila Neves wrote:
https://github.com/D-Programming-Language/phobos/pull/3968
I think fold should be nothrow, but maybe that's just me. It's
also a
massive pain to make it that way, so I didn't for now.
Returning Unqual!(ElementType!R).init makes no sense though.
The "correct" result of fold!f([]) is a (often, the) value 'a'
such that for any 'b', 'f(a,b)==b' (which is the canonical
choice of "seed"), but there is no way for fold to infer such a
value.
I wish we had some standardised way to express what the
identities (and maybe inverses) are for a given type under given
operations.