implements compressRec, compressFold, & mapFirst