怎样理解以下的结果?html
scala> val list = List(1,2,3,4,5)api
scala> list.reduceRight(_ - _)ide
res26: Int = 3this
执行过程以下:
scala
(1 - ( 2 - ( 3 - ( 4 - 5 ))))htm
官方文档说明:element
op(x_1, op(x_2, ..., op(x_{n-1}, x_n)...))
文档
where x1, ..., xn are the elements of this mutable indexed sequence.it
文档地址:table
https://www.scala-lang.org/api/current/scala/Array.html#reduceRight[B>:A](op:(A,B)=>B):B