From: <sp...@sc...> - 2006-08-30 05:10:28
|
Jonathan Roewen wrote: >> Do you think this should be added to ExtLib.ExtList, or is it too >> "specialized"? > > I don't think so. fold_reduce is a more general case of map_reduce. > fold_reduce? Do you mean fold? If not, then what does the fold_reduce you're thinking of look like? Anyway, I'm well aware that the reduce is a just special case of fold (where you assume that the folded function is "fully associative" by not specifying a fold "direction"). That's not the point, though. The point is that combining the map with a reduce you get lighter syntax all the _usage sites_ where you can use the idiom and that it is slightly better efficiency-wise for huge lists. There is also precedent for this kind of thing -- see ExtList.filter_map. Cheers, -- Bardur Arantsson <bar...@TH...> Absolutely no one can sex a lobster without cutting it open. rusty @ http://kuro5hin.org |