使用Scala的工作表,需要澄清[关闭](Using Scala's worksheet, clarification needed [closed])

编程入门 行业动态 更新时间:2024-10-23 06:17:46
使用Scala的工作表,需要澄清[关闭](Using Scala's worksheet, clarification needed [closed])

以下代码段编译并运行正常

当作为工作表的一部分使用时,我看到错误

为什么这样好?

The following snippet compiles and runs fine

When using as part of worksheet, i see error

Why is this please?

最满意答案

这可能只是一个错误/缺失的功能。

顺便说一句,您可以像下面的代码一样编写joiner来获得相同的行为,它也将避免工作表问题。

def joiner(strings: List[String], separator: String = " ") = strings.mkString(separator)

It's probably just a bug/missing feature.

By the way, you could write joiner like the following code to get the same behaviour, and it also will avoid the worksheet problem.

def joiner(strings: List[String], separator: String = " ") = strings.mkString(separator)

更多推荐

本文发布于:2023-08-07 04:46:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1460009.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:工作   worksheet   Scala   closed   needed

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!