ospatil (2) [Avatar] Offline
#1
Two has been spelled as to in the following line of Chapter 3 - Section "Passing code into foldLeft with Scala"
[pre]
The first thing we want to do is make ensure that op will receive as input, any function that takes to integers and returns an integer.
[/pre]
tomy (2) [Avatar] Offline
#2
The second definition of foldLeft reads as
def foldLeft(list:Array[Int], acc:Int, op):Int = {
  if (list.isEmpty) return acc
  foldLeft(op(list.head), acc, list.tail, op)
}

while it should read as
def foldLeft(list:Array[Int], acc:Int, op):Int = {
  if (list.isEmpty) return acc
  foldLeft(list.tail, op(list.head, acc), op)
}

(the comment just below these lines is correct: "op returns the new accumulator, which is the second argument")