[plt-scheme] Proposal for s-expr tracing format

From: Majorinc, Kazimir (kazimir at chem.pmf.hr)
Date: Sun Aug 12 08:48:01 EDT 2007

Now, when procedures are traced, the output is like

|(fibi 4)
| (fibi 3)
| |(fibi 2)
| | (fibi 1)
| | 1
| | (fibi 0)
| | 1
| |2
| |(fibi 1)
| |1
| 3
| (fibi 2)
| |(fibi 1)
| |1
| |(fibi 0)
| |1
| 2
|5

In this toy example, its readable. However, if output is much longer it 
becomes hard to follow these vertical bars. When that happens, I rewrite 
the procedure manually to get the output like this one:

(fibo (in 4)
(fibo (in 3)
(fibo (in 2)
(fibo (in 1)
(out 1))
(fibo (in 0)
(out 1))
(out 2))
(fibo (in 1)
(out 1))
(out 3))
(fibo (in 2)
(fibo (in 1)
(out 1))
(fibo (in 0)
(out 1))
(out 2))
(out 5))

Which is a mess, until I copy and paste it in editor window, select all 
and indent and it turns mess into beauty.

(fibo (in 4)
      (fibo (in 3)
            (fibo (in 2)
                  (fibo (in 1)
                        (out 1))
                  (fibo (in 0)
                        (out 1))
                  (out 2))
            (fibo (in 1)
                  (out 1))
            (out 3))
      (fibo (in 2)
            (fibo (in 1)
                  (out 1))
            (fibo (in 0)
                  (out 1))
            (out 2))
      (out 5))

The most important advantage is that now I can use parentheses matching 
feature in IDE to easily match in and out lines even if there are lot of 
lines in between. Even if few  different functions are traced and 
mutually called, parentheses take care about everything. Theoretically, 
it is easier to analyze the output by some program as well.

Can I propose such change of trace format in existing or alternative 
library? It shouldn't be hard for experienced person. Actually, it is so 
obvious that maybe someone already did something similar, do I miss 
something?

Kazimir Majorinc









Posted on the users mailing list.