Can all code be represented as a series of Map / Filter / Reduce operations?
- by Mongus Pong
I have recently been refactoring large chunks of code and replacing them with Linq queries.
Removing the language bias - Linq is essentially a set of Map / Filter and Reduce operations that operate on a sequence of data.
This got me thinking, how far would I theoretically be able to take this. Would I be able to rewrite the whole code base into a series (or even a single) of Map / Filter and Reduce operations.
Unfortunately I get paid to do useful stuff, so I haven't been able to experiment much further, but I can't think of any code structure that couldn't be re structured as such. Side effected code can be dealt with via monads.. Even output is essentially mapping memory addresses to screen addresses.
Is there anything that couldn't be (theoretically) rewritten as a Linq query?