How to get Function names?

How can I get function names defined in Lisp script?

Erik Sapir at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

If you want to know, which functions are defined in a certain package, you cane use with-package-iterator macro. Like this: (with-package-iterator (next (find-package 'test) :internal) (loop :for (more? sym) := (multiple-value-list (next)) :if (fboundp sym) :collect sym :into rez :else :unless more? :do (return rez))) If you want to just extract functions from a script(-file), the easiest way seems to be scanning it with a regex "\\(defun (.+)\\s" or something similar.

Vsevolod Dyomkin

In very simple cases, you can use regular expressions. In slightly less simple cases, implementing an S-expression reader might be a reasonable approach (you might even get away with ignoring reader macros altogether). In the general case, though, especially if macrology is involved, consider embedding http://common-lisp.net/project/armedbear/, which is a Java implementation of Common Lisp, and using the with-package-iterator form Vsevolod mentioned.

Matthias Benkard

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.