Skip to content

Instantly share code, notes, and snippets.

@jrsonline
Created January 26, 2018 22:58
Show Gist options
  • Save jrsonline/ca761fdd17d8dd2662a768344f8923a1 to your computer and use it in GitHub Desktop.
Save jrsonline/ca761fdd17d8dd2662a768344f8923a1 to your computer and use it in GitHub Desktop.
why no lmap
/// lmap works fine for linked list. Why can't Sequence define a generic one?
func lmap<S>(_ transform:(T) -> S) -> LinkedList<S> {
let l = LinkedList<S>()
for a in self {
l.addToEnd(transform(a))
}
return l
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment