map/reduce/reduceRight/filter function