//first, let's say we have this lisp file:
;clone a list
(defun clone(lst)
	(if (atom lst) lst
		(cons (clone (car lst))
					(clone (cdr lst))
		)
	)
)

//next, we can launch lisp, and do the following:
Break 4 [13]> (load "clone.lsp")
Break 9 [18]> trace clone
Break 11 [20]> (clone '(a b c))
1. Trace: (CLONE '(A B C))
2. Trace: (CLONE 'A)
2. Trace: CLONE ==> A
2. Trace: (CLONE '(B C))
3. Trace: (CLONE 'B)
3. Trace: CLONE ==> B
3. Trace: (CLONE '(C))
4. Trace: (CLONE 'C)
4. Trace: CLONE ==> C
4. Trace: (CLONE 'NIL)
4. Trace: CLONE ==> NIL
3. Trace: CLONE ==> (C)
2. Trace: CLONE ==> (B C)
1. Trace: CLONE ==> (A B C)
(A B C)
Break 11 [20]>
Advertisements