Created
January 26, 2018 22:58
-
-
Save jrsonline/ca761fdd17d8dd2662a768344f8923a1 to your computer and use it in GitHub Desktop.
why no lmap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 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