Does anyone know how to trace functions defined in a closure, without having to add (trace proc) into the closure?
For instance, this does not trace:
(define (hanoi n)
(define (pmd from to)
(display "Move ")
(display from)
(display " to ")
(display to)
(newline)
'())
(define (hanoi-move n from to spare)
(cond ((= n 0) '())
((= n 1) (pmd from to))
(else
(hanoi-move (- n 1) from spare to)
(hanoi-move 1 from to spare)
(hanoi-move (- n 1) spare to from))))
(hanoi-move n "A" "B" "C"))
;Value: hanoi
(trace hanoi-move)
;Unspecified return value
(hanoi 2)
Move A to C
Move A to B
Move C to B
;Value: ()
Inserting (trace hanoi-move) to (define (hanoi) ... ) and the trace works.
Thanks