difference between foldLeft and reduceLeft in Scala

后端 未结 7 2014
野性不改
野性不改 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:38

    To really understand what are you doing with fold/reduce, check this: http://wiki.tcl.tk/17983 very good explanation. once you get the concept of fold, reduce will come together with the answer above: list.tail.foldLeft(list.head)(_)

    0 讨论(0)
提交回复
热议问题