Add fold version of min and max