Skip to content

Instantly share code, notes, and snippets.

@xcoderzach
Created December 23, 2011 23:56
Show Gist options
  • Save xcoderzach/1515724 to your computer and use it in GitHub Desktop.
Save xcoderzach/1515724 to your computer and use it in GitHub Desktop.
Awaiting Apples
# this is what it would look like,
# Every language feature that isn't a function has to be turned into one :-(
awaitWhile {apples: []}, ({apples}) -> numThatAreTasty(apples) < 10
, (await) ->
await (defer) -> getAnApple defer "apples[]"
, ({apples}) ->
console.log apples
awaitWhile {apples: [], numTasty:0}, ({numTasty}) -> numTasty < 10
, (await) ->
await (defer) -> getAnApple defer "apples[]"
await (defer) -> countTasty apples, defer "num_tasty"
, ({apples}) ->
console.log apples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment