by carlob · 13y ago · 0 comments
The nice thing about map, as opposed to fold, is that you don't need to know the result of the ith step to do the i+1th.
What I was trying to say is that map is not universal, in that all function evaluations can be performed in parallel, because you can't use the result of the ith to compute the i+1th. In this respect map is in fact a restriction of fold.
BTW, Hutton's book on Haskell is just so excellent.
var i = 5;
var result = input.select(item => {
var val = item.v + i;
i = val;
return val;
});
This would be an awful programming practice, but it serves as an example that map isn't necessarily parrallelizable.