diff --git a/tests/bound contract/bound.rkt b/tests/bound contract/bound.rkt new file mode 100644 index 0000000..4197f94 --- /dev/null +++ b/tests/bound contract/bound.rkt @@ -0,0 +1,13 @@ +#lang racket + +(provide bound/c (rename-out (top~ #%top))) + +(define-syntax-rule (top~ . id) + (λ x `(id ,@x))) + +(define-syntax (bound/c stx) + (syntax-case stx () + [(_ x) + (if (identifier-binding #'x ) + #'x + #'(#%top . x))])) diff --git a/tests/bound contract/test.rkt b/tests/bound contract/test.rkt new file mode 100644 index 0000000..a3962ba --- /dev/null +++ b/tests/bound contract/test.rkt @@ -0,0 +1,5 @@ +#lang racket +(require "bound.rkt") + +(bar "hello") ; bar is unbound +((bound/c bar) "hello")