- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Re: Why is (sum _)(1, 2, 3) a type error
Wed, 2009-02-18, 19:16
On Tue, Aug 26, 2008 at 04:34:02PM +0300, Pietu Pohjalainen wrote:
> Today, while programming scala for the public audience, I encountered
> this, which I don't clearly understand:
>
> scala> def sum(a: Int, b: Int, c: Int) = a + b + c
> sum: (Int,Int,Int)Int
>
> scala> (sum _)(1, 2, 3)
> :6: error: type mismatch;
> found : (Int,Int,Int)Int
> required: (?, ?, ?) => ?
> (sum _)(1, 2, 3)
>
> Why is it a type error?
Sorry to revive a 6 month old thread, but while the wheels of bugfixing may grind slowly, they do grind - as of
a few minutes ago this works.
scala> def sum(a: Int, b: Int, c: Int) = a + b + c
sum: (Int,Int,Int)Int
scala> (sum _)(1, 2, 3)
res0: Int = 6