[plt-scheme] A tip regarding make-syntax-introducer

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Wed May 30 14:38:36 EDT 2007

Hi all,

Here is a little tip: the order of marking a syntax-object matter.

Consider:

Welcome to DrScheme, version 370.2-svn29may2007 [3m].
Language: Pretty Big (includes MrEd and Advanced Student); memory limit: 
900 megabytes.

 > (define-syntax (foo stx)
   (let ([introduce1 (make-syntax-introducer)]
         [introduce2 (make-syntax-introducer)])
     (syntax-case (list (introduce2 (introduce1 stx))
                        (introduce1 (introduce2 stx))) ()
       [((_ x12) (__ x21))
        #`(list
           #,(free-identifier=? #'x12 #'x21)
           #,(bound-identifier=? #'x12 #'x21))])))

 > (foo i)

(#t #f)

Notice the #f here.

This surprised me. Probably because the model used in
"Syntactic Abstraction in Scheme" by Dybvig et al. uses
sets of marks - which implies the order doesn't matter.

-- 
Jens Axel Søgaard






Posted on the users mailing list.