【发布时间】:2020-06-28 12:34:15
【问题描述】:
假设我们有以下函数:
def first(a: A): B = ???
def second(b: B): C = ???
我想用andThen 编写它们,但是下面的代码:
(first andThen second)(a)
结果:
<console>:14: error: missing argument list for method first
Unapplied methods are only converted to functions when a function type is expected.
You can make this conversion explicit by writing `first _` or `first(_)` instead of `first`.
(first andThen second) (1)
【问题讨论】:
标签: scala functional-programming composition