Refactorings and abstractions of the array folds and map