-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
F = Class((obj: Obj) -> F) | ||
|
||
greedy(obj) = | ||
log obj | ||
F.new greedy | ||
|
||
_ = greedy(1)::base(1)::base(1) | ||
|
||
Leaf = Class Int | ||
Leaf|<: Show|. | ||
__str__ ref self = "Leaf(\{self::base})" | ||
Node = Class { left = Tree; right = Tree } | ||
Node|<: Show|. | ||
__str__ ref self = "Node{ left = \{self::left}; right = \{self::right} }" | ||
Tree = Class Node or Leaf | ||
Tree|<: Show|. | ||
__str__ ref self = match self::base: | ||
(l: Leaf) -> l.__str__() | ||
(n: Node)-> n.__str__() | ||
|
||
print! Node.new { left = Tree.new Leaf.new 1; right = Tree.new Leaf.new 2 } |
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