You need to enable JavaScript to run this app. Scala方法柯里化调用为何可运行?isEmpty与花括号语义疑问
优惠活动
大模型
产品
解决方案
定价
更多

Scala方法柯里化调用为何可运行?isEmpty与花括号语义疑问

Scala柯里化代码相关疑问

具体疑问点

  • 该柯里化方法的调用形式为什么可以正常运行?
  • 代码链路末端的 .isEmpty 是什么含义?
  • 调用 test 方法时使用的大括号 { 有什么语义?是否指代传入了一个新函数?

对应原始代码

def test(age: Int)(name: name_class => name_class): String = {
  val str: String = name.toString() + age + ""
  print(str)
  str
}

test(19) {
  x =>
    name_class("dage1")
}.isEmpty

内容的提问来源于stack exchange,提问作者hammer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.23 22:57:01