Created
January 11, 2015 10:48
-
-
Save xnyhps/0835e1b94b6021aa66fb to your computer and use it in GitHub Desktop.
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
func replicate<C : ExtensibleCollectionType>(s:Int, x:C) -> C { | |
var ret : C = C() | |
for element in x { | |
for i in 1...s { | |
ret.append(element) | |
} | |
} | |
return ret | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment