Difference between fold and foldLeft or foldRight?

前端 未结 7 1772
星月不相逢
星月不相逢 2020-11-29 20:43

NOTE: I am on Scala 2.8—can that be a problem?

Why can\'t I use the fold function the same way as foldLeft or foldRight?

7条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 21:36

    You're right about the old version of Scala being a problem. If you look at the scaladoc page for Scala 2.8.1, you'll see no fold defined there (which is consistent with your error message). Apparently, fold was introduced in Scala 2.9.

提交回复
热议问题