List foldRight Zawsze używając foldLeft?

Właśnie spojrzałem naList.scalaRealizacjafoldRight().

  override def reverse: List[A] = {
    var result: List[A] = Nil
    var these = this
    while (!these.isEmpty) {
      result = these.head :: result
      these = these.tail
    }
    result
  }

  override def foldRight[B](z: B)(op: (A, B) => B): B =
    reverse.foldLeft(z)((right, left) => op(left, right))

Jak rozumiem, dzwoniącfoldRight naList skutkuje wywołaniemtheList.reverse.foldLeft(...).

JestList.foldRight zaimplementowane za pomocąfoldLeft w celu skorzystania z pojedynczej ramki stosu zamiast używania wielu ramek stosufoldLeft?

questionAnswers(1)

yourAnswerToTheQuestion