Scala currying vs partially applied functions

后端 未结 5 683
旧巷少年郎
旧巷少年郎 2020-11-27 09:57

I realize that there are several questions on here about what currying and partially applied functions are, but I\'m asking about how they are diff

5条回答
  •  野性不改
    2020-11-27 10:18

    Just to clarify on the last point

    Addition: As @asflierl has correctly pointed out, Scala doesn't seem to be able to infer the type when partially applying "normal" functions:

    Scala can infer types if all parameters are wildcards but not when some of them are specified and some of them not.

    scala> modN(_,_)
    res38: (Int, Int) => Boolean = 
    
    scala> modN(1,_)
    :13: error: missing parameter type for expanded function ((x$1) => modN(1, x$1))
           modN(1,_)
                  ^
    

提交回复
热议问题