Created
July 4, 2013 13:50
-
-
Save mraleph/5927922 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
class Step { | |
operator - (_) => this; | |
operator > (other) => new Seq(this, other); | |
} | |
class Atom extends Step { | |
final name; | |
Atom(this.name); | |
toString() => "${name}"; | |
} | |
class Seq extends Step { | |
final x, y; | |
Seq(this.x, this.y); | |
toString() => "${x} => ${y}"; | |
} | |
var x = new Atom("x"); // Unfortunately can't be final for we use -- on it :-/ | |
var y = new Atom("y"); | |
var z = new Atom("z"); | |
main() { | |
print (x --> y --> z); // x => y => z | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment