Implement map with fold