Scala currying vs partially applied functions

后端 未结 5 679
旧巷少年郎
旧巷少年郎 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:26

    The best explanation I could find so far: https://dzone.com/articles/difference-between-currying-amp-partially-applied

    Currying: decomposition of functions with multiple arguments into a chain of single-argument functions. Notice, that Scala allows passing a function as an argument to another function.

    Partial application of function: pass to a function fewer arguments than it has in its declaration. Scala does not throw an exception when you provide fewer arguments to the function, it simply applies them and returns a new function with rest of arguments that need to be passed.

提交回复
热议问题