Hacker News new | ask | show | jobs
by eigenspace 605 days 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.

1 comments

A smart enough compiler can and will fuse your loops / iterators.

GHC does for example.

Relying 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.