How can I get function names defined in Lisp script?
-
I have a Lisp file with some functions defined [ (defun ... ]. Is there an easy way to get all function names defined in the script using Java?
-
Answer:
Perhaps you can use some of the code from http://yama-linux.cc.kagoshima-u.ac.jp/~yamanoue/researches/java/Lisp/Lisp.html
Erik Sapir at Stack Overflow Visit the source
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:
- How do I get multiple names for me on myspace?Best solution by Yahoo! Answers
- How can I get an audio alert when I get a new e-mail?Best solution by Yahoo! Answers
- How can I get Bahrain police clearance and were can I apply for it in Australia?Best solution by Yahoo! Answers
- How can I get a text alert when I get an email?Best solution by Yahoo! Answers
- How do I Get Rid of My Lateral Lisp?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.