diff -r 59779ce322a6 -r ca48ac1d3c3e progs/yahoo.scala --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/progs/yahoo.scala Wed Jul 24 14:22:06 2019 +0100 @@ -0,0 +1,28 @@ +import io.Source +import scala.util._ + +object Foo { + +def get_data(symbol: String) : List[String] = + Source.fromFile(symbol ++ ".csv")("ISO-8859-1").getLines.toList + +def process(s: String) : String = { + val l = s.split(",").toList + l(0) + "," + l(5) + } + +def clean(sym: String) = { + val da = get_data(sym) + val out = + for (l <- da; + if l.drop(4).startsWith("-01")) yield process(l) + + println(process(da.head)) + out.foreach { println } + +} + + +def main(args: Array[String]) = clean(args(0)) + +}