[racket] Confusion with syntax marks
I am playing around with syntax marks and have a program whose output
confuses me.
#lang racket
(require (for-syntax racket/syntax))
(define-for-syntax marker (make-syntax-introducer))
(define-syntax (mark stx)
(syntax-case stx ()
((_ arg ...) (marker #'(begin arg ...)))))
(define foo 'a)
(mark
(define foo 'b)
foo
(mark foo))
foo
(mark foo)
(mark (mark foo))
This outputs 5 values depending on which foo a binding refers to.
Racket outputs 'b 'b 'a 'a 'a. But when I use the macro stepper and
look at the marks on the uses line up with the bindings they alternate
'b 'a 'a 'b 'a, which is what I was expecting, but the arrows line up
with the output. Can someone explain why I am getting these results?