curried the filter and fold functions as an experiment