Implement foldr in terms of foldl