Higher order functions on lists, used to implement run-length encoding at the end.
Concat, map and length in terms of foldRight