Skip to content

Instantly share code, notes, and snippets.

@andrewharmellaw
Last active November 15, 2015 20:19
Show Gist options
  • Save andrewharmellaw/f0ca07e468ba205615b6 to your computer and use it in GitHub Desktop.
Save andrewharmellaw/f0ca07e468ba205615b6 to your computer and use it in GitHub Desktop.
folding_blog_post-gist1
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