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?
my_list.map(_ignored => a copy of my_list)
, it seems like the space use of such a program is bounded by some polynomial (depending on the program length). Then such a language certainly couldn't compute problems that are not in PSPACE. However, as many problems in PSPACE are considered intractible, to say nothing of larger classes, this may not be a very serious restriction. – user7043 Aug 13 '15 at 10:20