4 ms·
This is just an unfortunate consequence of how map and filter are implemented via iterators. Of you work with transducers, the map filter map reduce is still j
by eigenspace 2y ago
This is just an unfortunate consequence of how map and filter are implemented via iterators.
Of you work with transducers, the map filter map reduce is still just one single loop.
- eru 2y agoA smart enough compiler can and will fuse your loops / iterators. GHC does for example.
- eigenspace 2y agoRelying on a sufficiently smart compiler to turn bad algorithms into good algorithms is unreliable. It's much better to just have a way of expressing efficient algorithms naturally, which is what transducers excel at.