map using pattern matching + recursion
map, filter, flatMap using fold