for loops as folds