Is it possible in common lisp to convert a function to a symbol or a string for further use? What i mean is to get a "+" or #:|+| from #'+.
Is it possible in common lisp to convert a function to a symbol or a string for further use? What i mean is to get a "+" or #:|+| from #'+.
The only standard way is
function-lambda-expression
which is not guaranteed to return anything useful.
Neverless, both CLISP and SBCL return the actual function name:
(nth-value 2 (function-lambda-expression #'+))
==> +
or, if you wish,
(symbol-name (nth-value 2 (function-lambda-expression #'+)))
==> "+"
(defun function-name (fn)
(string-downcase (symbol-name (nth-value 2 (function-lambda-expression fn)))))
(function-name #'atom) => "atom"