Skip to content

Instantly share code, notes, and snippets.

@hachinobu
Created August 9, 2015 12:49
Show Gist options
  • Save hachinobu/091257ddf24bfaf95936 to your computer and use it in GitHub Desktop.
Save hachinobu/091257ddf24bfaf95936 to your computer and use it in GitHub Desktop.
Swift map
func map<T, U>(xs: [T], f: T -> U) -> [U] {
var result: [U] = []
for x in xs {
result.append(f(x))
}
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment