[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

About TRACE





Yesterday  posted a mail about trace. Andrew asked to provide an explicit
example.

The following is a test function:

(defun flatten (lst)
   (cond ((null lst) nil)
         ((atom (car lst)) (cons (car lst) (flatten (cdr lst))))
         (t (append (flatten (car lst)) (flatten (cdr lst)))) ))


This is what I get with Trace:

? (trace flatten)
NIL
? (flatten '(a b (c (d (f g)))))
Calling (FLATTEN (A B (C #))) inside #<Root Object>
FLATTEN returned (A B C D F ...) inside #<Root Object>
(A B C D F G)
? 

Could someone explain what's going on here.

Shawkat Bhuiyan