Skip to content

Instantly share code, notes, and snippets.

@andrewharmellaw
Last active December 3, 2015 10:58
Show Gist options
  • Save andrewharmellaw/5fef78e758793e4041ec to your computer and use it in GitHub Desktop.
Save andrewharmellaw/5fef78e758793e4041ec to your computer and use it in GitHub Desktop.
def foldLeft[A,B](as: List[A], b: B)(f: (B, A) => B): B = as match {
case Nil => b
case 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