What constitutes a fold for types other than list?
A Fold for Every Occasion We can actually come up with a generic notion of folding which can apply to a whole bunch of different types. That is, we can systematically define a fold function for lists, trees and more. This generic notion of fold corresponds to the catamorphisms @pelotom mentioned in his comment. Recursive … Read more