Skip to content

Instantly share code, notes, and snippets.

@netguy204
Created September 16, 2012 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save netguy204/3732272 to your computer and use it in GitHub Desktop.
Save netguy204/3732272 to your computer and use it in GitHub Desktop.
Compiler Fail?
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