Advertisement
Guest User

Untitled

a guest
Nov 4th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.19 KB | None | 0 0
  1. class MyList[T](elems: T*){
  2.     .....    
  3.     def *(x: double){
  4.         val xs = elems.map((p: T) => p * x) // Arbitrary type T has no method * defined
  5.         new MyList[Double](xs)
  6.     }
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement