Jump to content

Talk:Partial function application: Difference between revisions

→‎Is Scala correct?: It fails the task requirement that "other parameters are not explicitely mentioned".
(→‎Is Scala correct?: It fails the task requirement that "other parameters are not explicitely mentioned".)
Line 148:
 
:: Hi Kernigh, if fs were defined as taking 3 arguments and currying would still refer to fs(f1,_) and not fs(f1,_,_) then I would be inclined to accept it as the '_' would stand for "any other arguments" rather than "any one argument" and would retain most of the insensitivity to the number of arguments of the Haskel-type implementations.
 
: <lang scala>scala> def rot(x: Int, y: Int, z: Int) = (y, z, x)
rot: (x: Int,y: Int,z: Int)(Int, Int, Int)
 
scala> rot(2, 3, 7)
res0: (Int, Int, Int) = (3,7,2)
 
scala> def a(y: Int) = rot(_: Int, y, _: Int)
a: (y: Int)(Int, Int) => (Int, Int, Int)
 
scala> a(3)(2, 7)
res1: (Int, Int, Int) = (3,7,2)</lang>
 
: It seems that _ is any one parameter. So, the Scala "partial application underscore" fails the task requirement that "other parameters are not explicitely mentioned". --[[User:Kernigh|Kernigh]] 02:17, 21 April 2011 (UTC)
 
==Is Lisp correct?==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.