3 ms·
Reduce is slightly different from fold because it does not use an initial value, which means its semantics differ somewhat with regards to restrictions on types
by saagarjha 7y ago
Reduce is slightly different from fold because it does not use an initial value, which means its semantics differ somewhat with regards to restrictions on types.
- hnra 7y agoReduce in Javascript has the initial value as an optional parameter.
- saagarjha 7y agoAnd it doesn't do types, so that's not really an issue either…
- johnday 7y agoFold does not always have an initial value either. The Wikipedia article linked in the post to which you responded says as much.
- saagarjha 7y agoSorry, I worded that poorly: fold usually does not have an initial value.