[plt-scheme] using a defined procedure in a syntax-case form

From: Filipe Cabecinhas (filcab at gmail.com)
Date: Mon May 12 16:06:08 EDT 2008

Hi,

I'm trying to use a helper function I defined in the same module in a  
syntax-case form, but I keep getting "unbound variable" errors.

Here's an example:
--------------------------
#lang scheme

(define (a str)
   (string-append "a" str))

(define-syntax b
   (lambda (stx)
     (syntax-case stx ()
       ((_ str)
        (with-syntax ([str2 (datum->syntax #'str (a (syntax->datum  
#'str)))])
          #'str2)))))
--------------------------

error: expand: unbound variable in module (transformer environment)  
in: a


Thanks for the help,

   - Filipe Cabecinhas





Posted on the users mailing list.