[英]Scala, Type could not find implicit value for parameter n
import Numeric._
import grizzled.math.stats._
val l = List[Double](123.0, 133.0, 155.0, 166.0, 177.0)
println(median(l))
Above you see an example which describes the usage of the package grizzled.math.stats
at scala grizzled doc . 以上你看到它描述了包的使用为例
grizzled.math.stats
在斯卡拉头发斑白的文档 。 I am not able to reproduce this simple example. 我无法重现这个简单的例子。
I always get following errors: 我总是收到以下错误:
Any suggestion to resolve this compilation error is welcome. 欢迎提供解决此编译错误的任何建议。 Thank you in advance.
先感谢您。
median
expects a var-arg argument. median
需要一个var-arg参数。 You could expand the list with _*
syntax, like this: 您可以使用
_*
语法扩展列表,如下所示:
import Numeric._
import grizzled.math.stats._
val l = List[Double](123.0, 133.0, 155.0, 166.0, 177.0)
println(median(l: _*))
This compiles and outputs 155.0. 这将编译并输出155.0。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.