fork download
  1. object Main extends App {
  2. def sum(xs: List[Int]): Int = {
  3. if(xs.isEmpty)
  4. 0
  5. println("" + xs)
  6. // xs.head + sum(xs.tail)
  7. }
  8.  
  9. println(sum(List(1,2,3,4)))
  10.  
  11. // your code goes here
  12. }
Compilation error #stdin compilation error #stdout 0.35s 382016KB
stdin
Standard input is empty
compilation info
/opt/scala/bin/scalac: line 50: /dev/null: Permission denied
Main.scala:5: error: type mismatch;
 found   : Unit
 required: Int
     println("" + xs)
            ^
one error found
spoj: The program compiled successfully, but Main.class was not found.
      Class Main should contain method: def main(args: Array[String]).
stdout
Standard output is empty