I like the way it works in JavaScript. Specifically, you need to either provide an "initial value", or make sure the list is nonempty. If you do neither of those, you get an error.
That's nice because it means something like [].reduce(infix:<min>) will just outright fail. (We can't exactly return inf there because, by #517, our infinities are syntactic.)
With things like [].reduce(infix:<+>) I guess we could ask the infix:<+> nicely if it has a "zero value". But that's beyond the scope of this issue.
(Filed while staring at #176.)
I like the way it works in JavaScript. Specifically, you need to either provide an "initial value", or make sure the list is nonempty. If you do neither of those, you get an error.
That's nice because it means something like
[].reduce(infix:<min>)
will just outright fail. (We can't exactly returninf
there because, by #517, our infinities are syntactic.)With things like
[].reduce(infix:<+>)
I guess we could ask theinfix:<+>
nicely if it has a "zero value". But that's beyond the scope of this issue.