Previously, Nicolas Rinaudo answered my question on Scala\'s List foldRight Always Using foldLeft?
Studying Haskell currently, my understanding is that foldRig
scala> val words = List("Hic", "Est", "Index")
words: List[String] = List(Hic, Est, Index)
Incase of foldLeft: List elements will add to the empty string first and followed
words.foldLeft("")(_ + _) == (("" + "Hic") + "Est") + "Index" //"HicEstIndex"
Incase of foldRight: Empty string will add to end of elements
words.foldRight("")(_ + _) == "Hic" + ("Est" + ("Index" + "")) //"HicEstIndex"
Both cases will return the same output
def foldRight[B](z: B)(f: (A, B) => B): B
def foldLeft[B](z: B)(f: (B, A) => B): B