3 ms·
Well, when you really boil it down, these are the fundamental operations. At least, I believe that is true. Someone stronger in CS theory could come along and
by charlieflowers 14y ago
Well, when you really boil it down, these are the fundamental operations.
At least, I believe that is true. Someone stronger in CS theory could come along and verify/correct that statement.
This paper [1], for example, appears to argue that FOLD (foldr in particular) is universal, meaning that there is only one way to move through a list and resolve it to a single value. In other words, you may have some other algorithm that you think is not a FOLD, but if it moves through a list and resolves it to one value, then your algorithm is FOLD. (I say the paper "appears" to claim that, because in all honesty there's about 10-15% of the paper that I didn't fully grok).
I suspect that applies to map/filter/etc. After all, if you look at their definitions, they contain nothing but the essence of the operation (map/filter/fold/etc) itself.
So, map/filter/fold/etc are THE operations on lists.
[1] http://www.cs.nott.ac.uk/~gmh/fold.pdf http://www.cs.nott.ac.uk/~gmh/fold.pdf