Skip to content

Instantly share code, notes, and snippets.

@levinotik
Created August 21, 2013 14:32
Show Gist options
  • Save levinotik/6295242 to your computer and use it in GitHub Desktop.
Save levinotik/6295242 to your computer and use it in GitHub Desktop.
def foldLeftViaFoldRight[A, B](l: List[A], z: B)(f: (B, A) => B): B = {
foldRight(l, (b:B) => b)((a,g) => b => g(f(b,a)))(z)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment