I understand that the difference between fold
{Left
/Right
} and fold
is that it is required the operator fed to fold
forms a monoid (or in the case of reduce
, a semigroup). This is mostly useful for parallel collections where a fold/reduce can be operated in parallel. However, in {fold
/reduce
}{Left
/Right
}, it is guaranteed that the operation will be done in a sequential, non-parallel way.
If so, scan
doesn’t make sense. scan
yields a new sequence that is inherently dependent on the original order of the sequence. Scanning in parallel does not make any sense.