[gambit-list] Help with a macro expansion.
Bradley Lucier
lucier at math.purdue.edu
Fri Sep 27 14:39:22 EDT 2013
On 09/27/2013 02:31 PM, Marc Feeley wrote:
> It seems you need commas before your references of result.
I don't think so:
(define-macro (while-tracing-naive-div-new expression)
(let ((result (gensym))
(args+result (gensym)))
`(let ((,args+result '()))
(set! naive-div
(lambda (u v)
(let ((result (naive-div-new u v)))
(set! ,args+result (cons (list u v result)
,args+result))
result)))
;; calculate expression with naive-div-new
(let ((,result ,expression))
;; set naive-div back to naive-div-orig before calling any more
number-manipulating routines
(set! naive-div naive-div-orig)
(pp (map (lambda (args+result)
(append args+result (list (naive-div-orig (car args+result)
(cadr args+result)))))
,args+result))
;; supposed to return result, but returns #!void ????????????????
,result))))
(while-tracing-naive-div-new (string->number (number->string xx)))
(let ((#:g4 ('#<procedure #24 ##box> '())))
(let ((begin-temp.27
(set! naive-div
(lambda (u v)
(let ((result (naive-div-new
u
v)))
(let ((begin-temp.24
('#<procedure #31
##set-box!>
#:g4
('#<procedure #5
cons>
('#<procedure
#6 list>
u
v
result)
('#<procedure
#25 ##unbox>
#:g4)))))
result))))))
(let ((#:g3 ('#<procedure #28
string->number>
('#<procedure #29
number->string>
xx))))
(let ((begin-temp.26
(set! naive-div naive-div-orig)))
(let ((begin-temp.25
(pp ('#<procedure #32 map>
(lambda (args+result)
('#<procedure #33 append>
args+result
('#<procedure #6 list>
(naive-div-orig
('#<procedure #9 car>
args+result)
('#<procedure #34
cadr>
args+result)))))
('#<procedure #25 ##unbox>
#:g4)))))
#!void)))))
More information about the Gambit-list
mailing list