Created
December 1, 2012 20:58
-
-
Save lossyrob/4185047 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
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