Skip to content

Instantly share code, notes, and snippets.

@dyoo
Created October 19, 2012 20:31
Show Gist options
  • Save dyoo/3920553 to your computer and use it in GitHub Desktop.
Save dyoo/3920553 to your computer and use it in GitHub Desktop.
maybe a bug in typed racket?
#lang typed/racket/base
;; These are the primitives that we know how to inline.
(define-type KernelPrimitiveName/Inline (U '+
'-
'*
'/
'zero?
'add1
'sub1
'<
'<=
'=
'>
'>=
'cons
'car
'caar
'cdr
'list
'list?
'pair?
'null?
'not
'eq?
'vector-ref
'vector-set!
))
(: operator->string (KernelPrimitiveName/Inline -> String))
(define (operator->string operator)
(case operator
[(+)
"+"]
[(-)
"-"]
[(*)
"*"]
[(/)
"/"]
[(zero?)
"zero?"]
[(add1)
"add1"]
[(sub1)
"sub1"]
[(<)
"<"]
[(<=)
"<="]
[(=)
"="]
[(>)
">"]
[(>=)
">="]
[(cons)
"cons"]
[(car)
"car"]
[(caar)
"caar"]
[(cdr)
"cdr"]
[(list)
"list"]
[(list?)
"list?"]
[(pair?)
"pair?"]
[(null?)
"null?"]
[(not)
"not"]
[(eq?)
"eq?"]
[(vector-ref)
"vector-ref"]
[(vector-set!)
"vector-set!"]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment