3 ms·
The "call it builder instead of reduce" comment here was interesting. My knee jerk response was to disagree, being that reduce is well known to mean fold / acc
by np_tedious 7y ago
The "call it builder instead of reduce" comment here was interesting.
My knee jerk response was to disagree, being that reduce is well known to mean fold / accumulate. However I've seen a lot of js usages where it does things like modify structures in the containing scope and isn't an FPish fold at all, so a name like that could probably make a lot of sense.
Nonetheless for this particular usage, I'd agree that a more specific partition function like lodash's would be an improvement.