You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the preview text of the 2nd edition the signatures of foldLeft and foldRight are consistent, but not in the git repository exercises module (the answers module is correct).
exercises module: def foldLeft[A,B](l: List[A], z: B)(f: (B, A) => B): B = ???
answers module: def foldLeft[A,B](l: List[A], z: B, f: (B, A) => B): B = ...
This raises the question should Scala's auto-curry feature be explained here? Currying has been covered in the previous chapter, so this would be a good oportunity to introduce that concept. This could also be applied to other HOFsin the 3rd chapter, i.e. filter or dropWhile.
The text was updated successfully, but these errors were encountered:
tPl0ch
changed the title
[2nd edition] Signatures of foldLeft and foldRight are inconsistent in answers and exercises module
[2nd edition] Signature of foldLeft is inconsistent in answers and exercises module
Sep 12, 2021
Thanks for spotting, I'll address shortly. There's a footnote that talks about the tradeoffs between the two signatures and how the tradeoff changes with Scala 3 type inference.
In the preview text of the 2nd edition the signatures of
foldLeft
andfoldRight
are consistent, but not in the git repository exercises module (the answers module is correct).exercises module:
def foldLeft[A,B](l: List[A], z: B)(f: (B, A) => B): B = ???
answers module:
def foldLeft[A,B](l: List[A], z: B, f: (B, A) => B): B = ...
This raises the question should Scala's auto-curry feature be explained here? Currying has been covered in the previous chapter, so this would be a good oportunity to introduce that concept. This could also be applied to other HOFsin the 3rd chapter, i.e.
filter
ordropWhile
.The text was updated successfully, but these errors were encountered: