(Wangle) Simplify reduce, use the same implementation for func returning T/Future<T>
Summary:
I wanted to use `collectAll` for `reduce` if `func` does not return a
Future, because the overhead seemed smaller, but it has been suggested
that running the callback as soon as possible might be better. Not sure
which is. Note that this also makes n copies of the lambda and moves the
value at least n times.
I also plan to add a `streamingReduce` which calls `func` as soon as
results come in (but out of order).
Test Plan: Run all the tests.
Reviewed By: hans@fb.com
Subscribers: folly-diffs@, jsedgwick, yfeldblum, chalfant
FB internal diff:
D2015316
Tasks:
6025252
Signature: t1:
2015316:
1430349611:
4f62a540ded85299a22670dd2add27cf1458e8f8