Thank you very much for the quick fix of the previous macro expander bug I reported.
Here, I have found another one while trying to port a program to Sagittarius. It seems to be more subtle.
In the program below, Sagittarius expands the line marked with "Test 1" without any complaint; on the other hand, it complains about a duplicate variable for the same expansion when it happens inside the
let at the line marked with "Test 2".
The duplicate variable comes from the definition marked with "X", I think. But the way the macro works, the definition should be expanded into
(define (c a b) 42) with
b the original identifiers, so there should be no duplicate variable.
(import (scheme base) (scheme write)) (define-syntax aux0 (syntax-rules () ((_ z k) (begin (define-syntax z (syntax-rules () ((_ %k) %k))) (z k))))) (define-syntax aux1 (syntax-rules () ((_ x* x) (aux2 x* () x)))) (define-syntax aux2 (syntax-rules () ((_ () y* x) (define (c . y*) 42)) ; X ((_ (w . x*) (y* ...) x) (aux0 x (aux2 x* (y* ... w) x))))) ;; Test 1 (aux1 (a b) y) (let () ;; Test 2 (aux1 (a b) y) 'foo)