Skip to content

Instantly share code, notes, and snippets.

@jarsen
Created January 29, 2015 16:09
Show Gist options
  • Save jarsen/2605446c05e4e0ddc125 to your computer and use it in GitHub Desktop.
Save jarsen/2605446c05e4e0ddc125 to your computer and use it in GitHub Desktop.
why does this crash?
func eratosthenes(n: Int) -> [Int]{
return map(enumerate(Array(1...n))) { (index, number) in
if number % index == 0 {
return -1
}
else {
return number
}
}
}
eratosthenes(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment