Skip to content

Instantly share code, notes, and snippets.

@dmsurti
Created August 21, 2015 14:20
Show Gist options
  • Save dmsurti/8364dcd636829eaf83d1 to your computer and use it in GitHub Desktop.
Save dmsurti/8364dcd636829eaf83d1 to your computer and use it in GitHub Desktop.
Trace CLOS method
CL-USER 1 > (load "~/tmp/trace-method.lisp")
; Loading text file /Users/deepaksurti/tmp/trace-method.lisp
#P"/Users/deepaksurti/tmp/trace-method.lisp"
CL-USER 2 > (test-foo)
1
CL-USER 3 > (trace (method foo (fixnum)))
((METHOD FOO (FIXNUM)))
CL-USER 4 > (test-foo)
0 (METHOD FOO (FIXNUM)) > ...
>> X : 1
0 (METHOD FOO (FIXNUM)) < ...
<< VALUE-0 : 1
1
CL-USER 5 > (untrace)
((METHOD FOO (FIXNUM)))
CL-USER 6 > (test-foo)
1
CL-USER 7 > (trace foo)
(FOO)
CL-USER 8 > (test-foo)
0 FOO > ...
>> X : "hello"
0 FOO < ...
<< VALUE-0 : "hello"
0 FOO > ...
>> X : 1
0 FOO < ...
<< VALUE-0 : 1
1
(defgeneric foo (x)
(:documentation "generic foo"))
(defmethod foo ((x fixnum))
x)
(defmethod foo ((x string))
x)
(defun test-foo ()
(foo "hello")
(foo 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment