Implemented `filter` using `foldr`