Implement filter and map via reduce.