[gambit-list] output of define-syntax

lowly coder lowlycoder at huoyanjinjing.com
Tue Feb 10 03:18:12 EST 2009


Session: ---

~/dynamic$ cat t2.scm
(define-macro (assert-equal lhs rhs)
  (let ((g-lhs (gensym))
        (g-rhs (gensym))
        (e-lhs (gensym))
        (e-rhs (gensym)))
    `(let ((,g-lhs ,lhs) (,g-rhs ,rhs)
           (,e-lhs ',lhs) (,e-rhs ',rhs))
       (if (not (equal? ,g-lhs ,g-rhs))
           (pp `(,,e-lhs = ,,g-lhs <> ,,g-rhs = ,,e-rhs))))))

(pp (lambda ()
      (assert-equal (+ 1 2) (- 3 4))) (current-output-port))

~/dynamic$ gsi t2.scm
(lambda ()
  (let ((#:g0 (+ 1 2)) (#:g1 (- 3 4)) (#:g2 '(+ 1 2)) (#:g3 '(- 3 4)))
    (if (not (equal? #:g0 #:g1))
        (pp `(,#:g2
              ,@`(,'= ,@`(,#:g0 ,@`(,'<> ,@`(,#:g1 ,@`(,'= ,@`(,#:g3
,@'())))))))))))
~/dynamic$


Question: ---

Why do I have:

  (pp `(,#:g2
              ,@`(,'= ,@`(,#:g0 ,@`(,'<> ,@`(,#:g1 ,@`(,'= ,@`(,#:g3
,@'())))))))))))

?

It seems prettier as:

`(,#:g2 '= ,#:g0 '<> ...)

the ,@` seems extraneous
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20090210/95b8c55b/attachment.htm>


More information about the Gambit-list mailing list