libera/#commonlisp - IRC Chatlog
Search
21:02:50
nij-
How do I get the name of the function? E.g. something like (function-name #'+) => "+" ?
21:06:26
Alfr
nij-, that usually isn't a valid function name, as those are either symbols or (setf some-symbol).
21:17:24
NotThatRPG
I'm having the oddest problem. I have a function that computes four values, the last of which is a closure. I print out that closure and then return it in a values construct in the next line. But when I trace the function, it displays as only returning THREE values. Any idea what could account for this? It's driving me bonkers.
21:24:47
pjb
Actually, we may consider that the name of the function (lambda () 42) #| --> #<Anonymous Function #x302005F3C76F> |# be (lambda () 42) it self! Since (function <my-function-name>) -> the function named my-function-name, and (function (lambda () 42)) -> the anonymous function in question.
21:25:56
pjb
nij-: (defun foo () 42) (setf (fdefinition 'bar) (fdefinition 'foo)) (defun foo () 33) (function-names (function foo)) #| --> (foo) |# (function-names (function bar)) #| --> (bar) |# (values (foo) (bar)) #| --> 33 ; 42 |#
21:26:31
pjb
(defun foo () 42) (setf (fdefinition 'bar) (fdefinition 'foo)) (values (function-names (function foo)) (function-names (function bar))) #| --> (bar foo) ; (bar foo) |#
21:33:54
pjb
nij-: naming is always relative to some authority, to some registry. An object can be given several names. So if you want to name your functions perhaps you should manage your own registry. https://termbin.com/6fmc
21:36:24
pjb
NotThatRPG: there's an infinite number of programs that behave as you describe !!! Why don't you paste the code immediately when you want debugging help?
21:36:36
White_Flame
NotThatRPG: how high are your optimization settings? maybe some things might become opaque to the tracer?
21:40:59
NotThatRPG
Will do. BTW, this couldn't be a valid compiler optimization: I'm trying to catch the fourth return value and use it, and it errors out right after return.