标签云

微信群

扫码加入我们

WeChat QR Code

I have a definition of next methods:def add1(x: Int, y: Int) = x + ydef add2(x: Int)(y: Int) = x + ythe second one is curried version of first one. Then if I want to partially apply second function I have to write val res2 = add2(2) _. Everything is fine. Next I want add1 function to be curried. I write val curriedAdd = (add1 _).curriedAm I right that curriedAdd is similiar to add2?But when I try to partially apply curriedAdd in a such way val resCurried = curriedAdd(4) _ I get a compilation error. Then I fix it to val resCurried = curriedAdd(4)Why the result of a Functions.curried differs from curried version of add function(from add2)?


This does not answer the question. curriedAdd(4) _ does not work but val i = curriedAdd(4); i _ works.

2019年08月19日20分19秒

The question was: "Why the resultof a Functions.curried differs from curried version of add function(from add2)?" I guess i pointed out the differences.

2019年08月19日20分19秒