I’m trying to resolve why I get differing results in a let form when using a macro versus using the expanded function version. Here’s an example using racket 5.93:
#lang racket (require (for-syntax racket/syntax)) (define *cont* identity) (define-syntax (=defun stx) (syntax-case stx () [(_ (name parm ...) body ...) (with-syntax ([f (format-id stx "=~a" #'name)] [*cont* (format-id stx "~a" '*cont*)]) #'(begin (define-syntax-rule (name parm ...) (f *cont* parm ...)) (define (f *cont* parm ...) body ...)))])) (=defun (foo x) *cont*) (let ([*cont* cdr]) (foo 10)) => #<procedure:identity> (let ([*cont* cdr]) (=foo *cont* 10)) => #<procedure:cdr> Why does the macro return identity, while the function returns cdd? Thanks! ____________________ Racket Users list: http://lists.racket-lang.org/users