|
|
|
|
|
by jonshea
5269 days ago
|
|
If anyone is able, would you please explain to me these two questions from the quiz? I’m stumped. Why does `toSeq` compile, but not `toIndexedSeq`? Set(1,2,3).toIndexedSeq sortBy (-_)
Set(1,2,3).toSeq sortBy (-_)
Why does `h` compile, but `f` does not? def add(x: Int, y: Int) = x + y
val f = add(1,_)
val h = add(_,_)
|
|
The other looks like some quirk of partial application. It's unlikely there's any fundamental reason, only an implementation imperfection.