[plt-scheme] How to let a new symbol (created in _syntax-case_) visible at top level ?
#lang scheme
(define-syntax defsymbol
(λ (stx)
(syntax-case stx ()
[(_ name val)
(with-syntax
([new-name
(string->symbol
(string-append "nv-" (symbol->string (syntax->datum #'name))))])
(datum->syntax
#f
(list #'define (syntax->datum #'new-name) #'val)
#f))])))
(defsymbol biz 4)
nv-biz
==>
expand: unbound identifier in module in: nv-biz
I am pretty sure that I am not the first to ask the question but I can't find the answer.
André Mayers, Ph.D., M. Ps.
professeur agrégé
Département d'informatique
Université de Sherbrooke
Sherbrooke (Québec) Canada J1K 2R1
tél: +1 819-821-8000 poste 62041
fax: +1 819-821-8200
andre.mayers at usherbrooke.ca
http://www.dmi.usherb.ca/~amayers