fork download
  1. object Main extends App {
  2. // your code goes here
  3. override def main(args:Array[String]){
  4.  
  5.  
  6.  
  7. //println(pair(double,triple)(3))
  8. val list = List("Once","more","unto","the","breach")
  9. val ltrs = list.map(_.toUppercase).flatMap(_.toList)
  10. val distinct = ltrs.removeDuplicates.sort(_<_)
  11. println(distinct)
  12.  
  13. }
  14.  
  15.  
  16.  
  17.  
  18. def pair(f:Double=>Double,g:Double=>Double) = (n:Double) => {
  19.  
  20. (f(n),g(n))
  21. }
  22.  
  23. def double(n:Double) = n*2
  24.  
  25. def triple(n:Double) = n*3
  26.  
  27.  
  28. def sum(a:Int,b:Int,f:Int=>Int):Int={
  29. if(a>b)
  30. 0
  31.  
  32. f(a)+sum(a+1,b,f);
  33. }
  34. }
  35.  
  36. }
Compilation error #stdin compilation error #stdout 0.37s 382080KB
stdin
Standard input is empty
compilation info
/opt/scala/bin/scalac: line 50: /dev/null: Permission denied
Main.scala:9: error: value toUppercase is not a member of String
		val ltrs = list.map(_.toUppercase).flatMap(_.toList)
                                      ^
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