Skip to content

Instantly share code, notes, and snippets.

@andrewharmellaw
Last active December 3, 2015 11:17
Show Gist options
  • Save andrewharmellaw/c3da6d164d19c6fe5a45 to your computer and use it in GitHub Desktop.
Save andrewharmellaw/c3da6d164d19c6fe5a45 to your computer and use it in GitHub Desktop.
foldLeft(List(1,2,3), 0) (_ + _) // step 1 - where we start
foldLeft(1 :: 2 :: 3 :: Nil, 0) (_ + _) // micro-step 1(a)
foldLeft(2 :: 3 :: Nil, f(0, 1)) (_ + _) // micro-step 1(b)
foldLeft(2 :: 3 :: Nil, (0 + 1)) (_ + _) // step 2 - where we end up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment