Does anyone know how to trace functions inside a closure?  I would like to 
trace hanoi-move, however find that with MIT Scheme I need to place (trace) 
within the closure (hanoi n), otherwise the trace will not occur.

Can a trace like this be performed in Racket?

Thanks

 (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"))

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/92efb57d-6f32-47bb-89ec-98d9a4a5aed0%40googlegroups.com.

Reply via email to