部分应用是一种更广泛的技巧,它与局部套用类似,但是生成的函数并不限于单函数。
Partial application is a broader technique that resembles currying but does not restrict the resulting function to a single argument.
当然,Scala 支持局部套用,如清单 8 展示的 Scala 文档的部分片段所示
Of course, Scala supports currying, as illustrated by the snippet from the Scala documentation shown in Listing 8
要使用volume作为代码块的构建块并返回线段的长度,可以执行部分应用或局部套用。
To use volume as a building block for a code block that returns the length of a line segment, I can perform either partial application or currying.
应用推荐