// // program to sum integers from file (more compact version) // import scala.io.Source println("name of input file?") val fileName = readLine val source = Source.fromFile(fileName) var sum = source.getLines.map(_.toInt).sum source.close println("sum = " + sum)