Skip to content

Instantly share code, notes, and snippets.

@andrewharmellaw
Last active November 15, 2015 20:43
Show Gist options
  • Save andrewharmellaw/e2562f2d93352d2e82dd to your computer and use it in GitHub Desktop.
Save andrewharmellaw/e2562f2d93352d2e82dd to your computer and use it in GitHub Desktop.
Trace of a simple foldLeft
foldLeft(List(1,2,3), 0) (_ + _)
foldLeft(Cons(1, Cons(2, Cons(3, Nil))), 0) (_ + _)
foldLeft(Cons(2, Cons(3, Nil)), (0 + 1)) (_ + _)
foldLeft(Cons(3, Nil), ((0 + 1) + 2)) (_ + _)
foldLeft(Nil, (((0 + 1) + 2) + 3)) (_ + _)
(((0 + 1) + 2) + 3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment