Created
April 23, 2015 13:45
-
-
Save pnwamk/860250e7242e4241f434 to your computer and use it in GitHub Desktop.
ADTs in TR
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
| (define-datatype Expr | |
| [Var (Symbol)] | |
| [Lambda (Symbol Expr)] | |
| [App (Expr Expr)]) | |
| (: foo (Expr -> Symbol)) | |
| (define (foo e) | |
| (type-case Expr e | |
| [(Var x) => x] | |
| [(Lambda y b) => y] | |
| [(App l r) => 'fool])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment