Skip to content

Instantly share code, notes, and snippets.

@gabrielcorado
Created October 14, 2016 22:31
Show Gist options
  • Save gabrielcorado/9ffb7aad990803f0a9038ab706c1155f to your computer and use it in GitHub Desktop.
Save gabrielcorado/9ffb7aad990803f0a9038ab706c1155f to your computer and use it in GitHub Desktop.
Nice example of Coroutines
Say you're in the kitchen in front of the refrigerator, thinking about a sandwich. You take a continuation right there and stick it in your pocket. Then you get some turkey and bread out of the refrigerator and make yourself a sandwich, which is now sitting on the counter. You invoke the continuation in your pocket, and you find yourself standing in front of the refrigerator again, thinking about a sandwich. But fortunately, there's a sandwich on the counter, and all the materials used to make it are gone. So you eat it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment