Last active
November 15, 2015 20:19
-
-
Save andrewharmellaw/f0ca07e468ba205615b6 to your computer and use it in GitHub Desktop.
folding_blog_post-gist1
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
def foldLeft[A,B](as: List[A], b: B)(f: (B, A) => B): B | |
as match { | |
case Nil => b | |
case Cons(h,t) => foldLeft(t, f(b, h))(f) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment