Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def aa(i: Int) = i+2
- object bb { def apply(i: Int) = i+2 }
- scala> aa(1)
- res7: Int = 3
- scala> bb(1)
- res8: Int = 3
- scala> List(1,2,3).map(aa)
- res5: List[Int] = List(3, 4, 5)
- scala> List(1,2,3).map(bb)
- <console>:7: error: type mismatch;
- found : bb.type (with underlying type object bb)
- required: (Int) => ?
- List(1,2,3).map(bb)
- ^
Add Comment
Please, Sign In to add comment