Created
August 22, 2012 21:21
-
-
Save kragen/3429503 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simplified CoffeeScript version of voting code from | |
# <http://www.cap-lore.com/CapTheory/Language/lambdaSecurity.html>: | |
# simplified from <https://gist.github.com/3429195>. | |
counter = -> | |
x = 0 | |
voterMaker: -> | |
yet = true | |
-> if yet | |
yet = false | |
++x | |
votes: -> x | |
restaurants = ["Mandarin", "Casa Lupe", "Coffee Shop"] | |
lunchCrowd = ['Jim', 'Sue', 'Tom', 'Jennifer']; | |
noontime = -> | |
slate = for name in restaurants | |
name: name | |
counter: counter() | |
for e in lunchCrowd | |
SEND e, "Lunchtime!", | |
for r in slate | |
name: r.name | |
vote: r.voterMaker() | |
-> for r in slate | |
name: r.name | |
votes: r.counter.votes() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment