|
|
Re: Partially applied function (8.6, page 181)
|
Posted: Nov 23, 2008 4:00 PM
|
|
Yes, I understand that (my previous comment was wrong).
But my point is: yes, it is a function literal with placeholders, but there is no partially applied function here, because the only argument of this function literal is supplied at the point of invocation.
Again, a book says on a page 181 (in last edition) that, "In Scala, when you invoke a function, passing in any needed arguments, you apply that function to the arguments... A partially applied function is an expression in which you don't supply all of the arguments needed by the function. Instead, you supply some, or none, of the needed arguments." But in our case we never invoke our function literal without supplying its single argument, so there is no partially appllied function there.
All book examples shows how to create partially applied functions from regular functions ( def sum(a: Int, b: Int, c: Int) = a + b + c, defined on a page 181 ), not from function literals. I'm not sure if it is possible and makes sense to create a partially applied function from function literal.
|
|