tags:

views:

69

answers:

1

Is there any way to create something similar to this:

class F[A] {def apply(a: A) = println(a)}

So that I can:

(new F[Int*])(1,2,3)

UPDATE: but otherwise, I want F to accept normal parameters:

(new F[Int])(1)
+1  A: 
scala> class F[A] { def apply(a: A*) = a.length }
defined class F    

scala> val instance = new F[Int]
instance: F[Int] = F@11a6631

scala> instance(1,2,3,4,5)
res4: Int = 5
michael.kebe
not exactly what i was going for (i wanted apply to have the signature a: A), but it did make me realize I can just always use A*...
IttayD