Skip to content

Instantly share code, notes, and snippets.

@pnwamk
Created April 23, 2015 13:45
Show Gist options
  • Select an option

  • Save pnwamk/860250e7242e4241f434 to your computer and use it in GitHub Desktop.

Select an option

Save pnwamk/860250e7242e4241f434 to your computer and use it in GitHub Desktop.
ADTs in TR
(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