怎樣理解以下的結果?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