Search code examples
emacscommon-lispsbclslime

How can I list all of the defined functions and global variables that are active in common lisp


Is it possible to determine what the current environment has defined (in the common lisp image), from the running system itself?

I am running SBCL 1.3.14 and SLIME 2016-04-19 in GNU Emacs 25.1.1.


Solution

  • You can get the list of all packages using list-all-packages, and for each package you can see what goodies it export using do-external-symbols:

    (do-external-symbols (s "SB-EXT")
      (when (fboundp s)
        (format t "~S names a function~%" s))
      (when (boundp s)
        (format t "~S names a variable~%" s)))
    

    You might also want to check documentation:

    (do-external-symbols (s "SB-EXT")
      (when (and (fboundp s) (documentation s 'function))
        (format t "~S names a documented function~%" s))
      (when (and (boundp s) (documentation s 'variable))
        (format t "~S names a documented variable~%" s)))
    

    PS. If you are looking for something specific, you should also try apropos.