Created
November 16, 2015 20:53
-
-
Save andrewharmellaw/698b8abfa796491a6985 to your computer and use it in GitHub Desktop.
The meaty bits of foldLeft and foldRight
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// foldLeft's meaty bit | |
case Cons(h,t) => foldLeft(t, f(b, h))(f) | |
// foldRight meaty bit | |
case Cons(x, xs) => f(x, foldRight(xs, b)(f)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment