I prefer map to fold, it's much clear for me to thinking in map than fold.
Fold has a sound mathematic background : induction. While it's good to reason about the correctness of
program, it adds an unnecessary constrain: the elements have to be processed from left to right.
While with map, all elements can be process parallel.
1 comment:
Two thoughts: 1) you may (and I actually did) define your fold as reducer with unspecified order; and 2) It is very convenient to think about fold and map as specialization of ordinary for loop.
Post a Comment