foldr in terms of map