- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Re: things must be different..
Mon, 2011-07-25, 22:54
On Mon, 25 Jul 2011 23:42:47 +0200
Sébastien Bocq wrote:
> This is what you expressed:
>
> val f:Data => Bag[Thing] = new Thing dress
> println(mapIt[Data,Thing](datas, f))
>
> So this is expected.
Aha, I see. On mapIt() call a second argument value (which is a function) is calculated once. To force without-underscore case to work I can, say, modify mapIt():
def mapIt[A,B](list : Seq[A], f : => A => Bag[B]) : Seq[B] = list.map(f(_).t)
Fine, thanks to all!
Andrew