progs/lecture3.scala
changeset 364 18942af74fa1
parent 343 51e25cc30483
child 366 d2f895c1dba6
equal deleted inserted replaced
363:9f481fd7c613 364:18942af74fa1
   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