fork download
  1. class Main {
  2.  
  3. def doIt(l : MyList) : Int = {
  4. l match {
  5. case Nil() =>
  6. print(0)
  7. 0
  8. case Cons(v,t) =>
  9. print(v + doIt(t))
  10. v
  11. }
  12. }
  13.  
  14. def main() = {
  15. val ll = Cons(1,Cons(2,Cons(3,Nil())))
  16. val k = doIt(ll)
  17. }
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.scala:3: error: not found: type MyList
def doIt(l : MyList) : Int = {
             ^
Main.scala:5: error: object Nil is not a case class constructor, nor does it have an unapply/unapplySeq method
    case Nil() =>
         ^
Main.scala:8: error: not found: value Cons
    case Cons(v,t) => 
         ^
Main.scala:9: error: not found: value v
       print(v + doIt(t))
             ^
Main.scala:10: error: not found: value v
       v
       ^
Main.scala:15: error: not found: value Cons
val ll = Cons(1,Cons(2,Cons(3,Nil())))
         ^
6 errors found
stdout
Standard output is empty