Created
September 16, 2012 12:40
-
-
Save netguy204/3732272 to your computer and use it in GitHub Desktop.
Compiler Fail?
This file contains 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
deffun counter_inc(self) | |
self.x = +(self.x, 1) | |
in | |
deffun counter_dec(self) | |
self.x = -(self.x, 1) | |
in | |
deffun make_counter(start) | |
{ inc: counter_inc, dec: counter_dec, x: start } | |
in | |
defvar x1 = make_counter(1) in | |
defvar x2 = make_counter(2) in { | |
print(x1@inc().x); | |
print(x2@inc().x); | |
print(x1@inc().x); | |
print(x2@inc().x); | |
print(x1@inc().x); | |
print(x2@inc()@inc()@inc().x); | |
""; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment