Guest User

Untitled

a guest
Jul 19th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. def aa(i: Int) = i+2
  2. object bb { def apply(i: Int) = i+2 }
  3.  
  4. scala> aa(1)
  5. res7: Int = 3
  6.  
  7. scala> bb(1)
  8. res8: Int = 3
  9.  
  10. scala> List(1,2,3).map(aa)
  11. res5: List[Int] = List(3, 4, 5)
  12.  
  13. scala> List(1,2,3).map(bb)
  14. <console>:7: error: type mismatch;
  15. found : bb.type (with underlying type object bb)
  16. required: (Int) => ?
  17. List(1,2,3).map(bb)
  18. ^
Add Comment
Please, Sign In to add comment