fork download
  1. object Main extends App {
  2.  
  3. val f:(Int=>Int=>String)=
  4. a=>b=>if((a|b)==0)"That goes nowhere, silly!"else Seq("North ","","South ")(b+1)+Seq("West","","East")(a+1)
  5.  
  6.  
  7. println(f(1)(1))
  8. println(f(0)(1))
  9. println(f(1)(-1))
  10. println(f(0)(0))
  11.  
  12. }
Success #stdin #stdout 0.37s 4382720KB
stdin
Standard input is empty
stdout
South East
South 
North East
That goes nowhere, silly!