Thank you for your comment

Beau­tiful Racket / explainers

  1. (define x 42)
    (define-macro (mac)
      #'(println x))
    (mac) ; 42
    1
    2
    3
    4
    (define x 42)
    (define-macro (mac)
      #'(println x))
    (mac) ; 42
    
    copy to clipboard
  2. (define x 42)
    (define-macro (mac)
      #'(begin
          (define x 84)
          (println x)))
    (mac) ; 84
    1
    2
    3
    4
    5
    6
    (define x 42)
    (define-macro (mac)
      #'(begin
          (define x 84)
          (println x)))
    (mac) ; 84
    
    copy to clipboard
  3. (define x 42)
    (define-macro (mac)
      #'(begin
          (define x 84)
          (println x)))
    (mac) ; 84
    (println x) ; 42
    1
    2
    3
    4
    5
    6
    7
    (define x 42)
    (define-macro (mac)
      #'(begin
          (define x 84)
          (println x)))
    (mac) ; 84
    (println x) ; 42
    
    copy to clipboard
    (define-macro (define-x)
      #'(define x 42))
    (define-x)
    (println x) ; error: unbound identifier
    1
    2
    3
    4
    (define-macro (define-x)
      #'(define x 42))
    (define-x)
    (println x) ; error: unbound identifier
    
    copy to clipboard
    (let ([x 42])
      x)
    (println x) ; error: unbound identifier
    1
    2
    3
    (let ([x 42])
      x)
    (println x) ; error: unbound identifier
    
    copy to clipboard
  4. (define x 42)
    (define-macro (mac OUTER-X)
      #'(begin
          (define x 84)
          (println x)
          (println OUTER-X)))
    (mac x)
    1
    2
    3
    4
    5
    6
    7
    (define x 42)
    (define-macro (mac OUTER-X)
      #'(begin
          (define x 84)
          (println x)
          (println OUTER-X)))
    (mac x)
    
    copy to clipboard
    84
    42
    1
    2
    84
    42
    
    copy to clipboard
← prev next →