progs/lecture3.scala
changeset 364 f1a6fa599d26
parent 343 c8fcc0e0a57f
child 366 1c829680503e
equal deleted inserted replaced
363:e5c1d69cffa4 364:f1a6fa599d26
   413 // the JVM is not as clever as other functional languages. It can 
   413 // the JVM is not as clever as other functional languages. It can 
   414 // only optimise "self-tail calls". This excludes the cases of 
   414 // only optimise "self-tail calls". This excludes the cases of 
   415 // multiple functions making tail calls to each other. Well,
   415 // multiple functions making tail calls to each other. Well,
   416 // nothing is perfect. 
   416 // nothing is perfect. 
   417 
   417 
   418 
       
   419 
       
   420 
       
   421 
       
   422 
       
   423 
       
   424 
       
   425 
       
   426 
       
   427 //************
       
   428 // Either
       
   429 val either1 : Either[Exception,Int] = Right(1)
       
   430 val either2: Either[Exception, Int] = Right(2)
       
   431 
       
   432 for{
       
   433   one <- either1
       
   434   two <- either2
       
   435 } yield one + two