Skip to content

Instantly share code, notes, and snippets.

@lossyrob
Created December 1, 2012 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lossyrob/4185047 to your computer and use it in GitHub Desktop.
Save lossyrob/4185047 to your computer and use it in GitHub Desktop.
object PrimeGenerator {
def getPrimes(start:Int,end:Int):Seq[Int] = Seq(1,2,3,4) //stub
def splitInput(line:String) = {
val parts = line.split(" ")
if(parts.length != 2) { sys.error("not cool") }
(parts(0).toInt,parts(1).toInt)
}
def main(args: Array[String]){
val s = io.Source.stdin
val toNums:String => Seq[Int] = (_:String).split(" ").map(_.toInt)
val lines = s.getLines.drop(1)
for(input <- lines) {
val (start,end) = splitInput(input)
for(p <- getPrimes(start,end)) {
println(p.toString)
}
println()
}
0
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment