Skip to content

Instantly share code, notes, and snippets.

@levinotik
Created August 21, 2013 14:17
Show Gist options
  • Select an option

  • Save levinotik/6295051 to your computer and use it in GitHub Desktop.

Select an option

Save levinotik/6295051 to your computer and use it in GitHub Desktop.
def foldRight[A, B](l: List[A], z: B)(f: (A, B) => B): B = l match {
case Nil => z
case Cons(x, xs) => f(x, foldRight(xs, z)(f))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment