Permalink
Browse files

working code tracer

  • Loading branch information...
1 parent 0b2883d commit 7cd7826c2ec128462e5256e15bfc8dfd56b2abf0 @jlongster jlongster committed with Feb 16, 2012
Showing with 16 additions and 14 deletions.
  1. +16 −14 new/tests/trace.ol
View
@@ -19,24 +19,26 @@
(define level 0)
(define (trace-form src k)
- (print-trace level src)
+ (define (pad n s)
+ (vector-for-each (lambda (_) (display s))
+ (make-vector (* n 2)))
+ (if (> n 0)
+ (display " ")))
+
+ (pad level "-")
+ (pretty src)
+ (display "\n")
+
(set! level (+ level 1))
(let ((value (k)))
(set! level (- level 1))
- (print-trace level value)
- value))
-(define (print-trace level obj)
- (define (pad n)
- (vector-for-each (lambda (_) (display "|"))
- (make-vector (* n 4))))
-
- (pad level)
- (if (list? obj)
- (pretty obj)
- (display (inspect obj)))
- (display "\n"))
+ (pad level ">")
+ (display "RESULT: ")
+ (pretty value)
+ (display "\n")
+
+ value))
(trace-source (let ((i (+ 4 5)))
(+ i (* 2 (/ 3 4)))))
-

0 comments on commit 7cd7826

Please sign in to comment.