Talk:Partial function application: Difference between revisions

(→‎Explicit curry vs Partial application: Java not partial application.)
Line 86:
 
:: Hi Kernigh, the above is ''not'' like Haskel, in fact it doesn't really answer the task as you have made fs a function of only f, then called it with different f. Partial application would be like the Haskel: fs is a function of f ''and s'' and then fsfl is the result of applying only f1 to fs, without mention of any other argument. The above may give a result, but it is ''how'' it gets to that result that is the issue. --[[User:Paddy3118|Paddy3118]] 23:07, 14 April 2011 (UTC)
 
==Is Scala correct?==
I don't know scala, but it seems that in the following:
<lang scala>def fs(f:Int=>Int, s:List[Int])=s map f
def f1(x:Int)=x*2
def f2(x:Int)=x*x
def fsf1=fs(f1,_:List[Int])
def fsf2=fs(f2,_:List[Int])
 
println(fsf1(List(0,1,2,3)))
println(fsf1(List(2,4,6,8)))
println(fsf2(List(0,1,2,3)))
println(fsf2(List(2,4,6,8)))</lang>
In the definition of fsf1, the second argument to fs is explicitely mentioned as '_' - as is the return type of List[Int]. Compare it to the Haskel where both are implied.
 
I think I will have to mark this as incorrect. --[[User:Paddy3118|Paddy3118]] 23:45, 14 April 2011 (UTC)
Anonymous user