difference between foldLeft and reduceLeft in Scala

后端 未结 7 2033
野性不改
野性不改 2020-12-12 08:49

I have learned the basic difference between foldLeft and reduceLeft

foldLeft:

  • initial value has to be passed
7条回答
  •  长情又很酷
    2020-12-12 09:31

    The basic reason they are both in Scala standard library is probably because they are both in Haskell standard library (called foldl and foldl1). If reduceLeft wasn't, it would quite often be defined as a convenience method in different projects.

提交回复
热议问题