From 02e9f5cf4f0654b7f0ce07b647bd06b6f2ab8d86 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Fri, 7 Feb 2014 22:46:15 -0800 Subject: [PATCH] bound/c test --- tests/bound contract/bound.rkt | 13 +++++++++++++ tests/bound contract/test.rkt | 5 +++++ 2 files changed, 18 insertions(+) create mode 100644 tests/bound contract/bound.rkt create mode 100644 tests/bound contract/test.rkt 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")