I'm using sbcl 1.4.6 and I have this behaviour:
* (trace string<)
(STRING<)
* (string< "hola" "pato")
0: (STRING< "hola" "pato")
0: STRING< returned 0
0
* (defun test-without-cond (str)
(string< "hola" str))
TEST-WITHOUT-COND
* (test-without-cond "pato")
0
If the function is allready defined in common lisp, I cannot use trace when using inside a user defined function. BUt this is not a problem if I define the function
* (defun my-string< (str) (string< str "hello"))
MY-STRING<
* (trace my-string<)
(MY-STRING<)
* (defun test-2 (str) (my-string< str))
TEST-2
* (test-2 "gato")
0: (MY-STRING< "gato")
0: MY-STRING< returned 0
0
Why is this happening?
What can be traced depends on the implementation and various settings.
For SBCL read the manual: Open Coding and Inline Expansion
But SBCL now also has an interpreter and it looks like you can trace calls to CL functions from interpreted code:
* (setf *evaluator-mode* :interpret)
:INTERPRET
* (trace string<)
(STRING<)
* (defun test-without-cond (str)
(string< "hola" str))
TEST-WITHOUT-COND
* (test-without-cond "pato")
0: (STRING< "hola" "pato")
0: STRING< returned 0
0
*
Note that one might need to be careful with tracing core functions, since they can be called a lot...