Created
March 13, 2014 13:59
-
-
Save tonymorris/9529004 to your computer and use it in GitHub Desktop.
Lets Tell Lies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object LetsTellLies { | |
| def f1[A]: List[A] => Int = | |
| _ => util.Random.nextInt | |
| def f2[A]: List[A] => Int = | |
| f2 | |
| def f3[A]: List[A] => Int = | |
| _ => { | |
| println("hi") | |
| 7 | |
| } | |
| def f4[A]: List[A] => Int = | |
| _.head.asInstanceOf[Int] | |
| def f5[A]: List[A] => Int = | |
| _.toString.length | |
| def f6[A]: List[A] => Int = | |
| l => if(l == List(1, 2, 3)) 12 else 4 | |
| def f7[A]: List[A] => Int = | |
| l => if(l == null) 5 else 9 | |
| def f8[A]: List[A] => Int = { | |
| case a: Seq[_] => a.length | |
| case _ => 8 | |
| } | |
| def f9[A]: List[A] => Int = | |
| sys.error("bang") | |
| def f10[A]: List[A] => Int = | |
| _.hashCode | |
| def f11[A]: List[A] => Int = | |
| l => if(l.getClass.getName.startsWith("xqw")) 9 else 1 | |
| def f12[A]: List[A] => Int = { | |
| l => l.notifyAll | |
| 3 | |
| } | |
| def f13[A]: List[A] => Int = { | |
| l => l.wait | |
| 3 | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment