4 ms·
Streaming fusion exists, and can easily be implemented in C++, that's what authors of this library should have done. C++ ranges library (proposition for C++17)
by spooningtamarin 11y ago
Streaming fusion exists, and can easily be implemented in C++, that's what authors of this library should have done. C++ ranges library (proposition for C++17) will make this kind of thing possible without any overhead. Realistically, STL interface for sequences is pretty bad and barely composable.
This is not a problem with "functional style", it's a problem with library design.
writing
map (+2) (map (+1) (map (+3) xs))
will be just a single pass over a list in Haskell, with 3 function applications (maybe 1 if that is optimized to (+6)).
- Dobiasd 11y agoYes, stream fusion is a really cool thing. I do not know how to implement it without making things complicated in my Library. I know it is not designed perfectly.