Bleeding Fingers
Bleeding Fingers

Reputation: 7129

How to get a list of all builtins?

Learning Lisp from Practical Common Lisp I'm constantly coming across new builtin form s (please correct me if haven't used the right terminology). The latest one was 'character.

So I was wondering is there a command to get a list of all the builtins in Common Lisp? So that I could just easily skim through them all in one place.

Maybe something akin to Python's dir(__builtins__).

Additional tip would be appreciated.

Upvotes: 2

Views: 236

Answers (1)

Samuel Edwin Ward
Samuel Edwin Ward

Reputation: 6675

You could collect a list of all of the external symbols in the COMMON-LISP package:

(let (lst)
  (do-external-symbols (s (find-package 'common-lisp) lst)
    (push s lst)))

There are a lot of them! Check out the symbol index of the hyperspec.

A lot of these symbols you'll probably never use, and I'm not sure it's worthwhile to look at each of them.

I would recommend becoming somewhat familiar with all of the special forms:

block      let*                  return-from      
catch      load-time-value       setq             
eval-when  locally               symbol-macrolet  
flet       macrolet              tagbody          
function   multiple-value-call   the              
go         multiple-value-prog1  throw            
if         progn                 unwind-protect   
labels     progv                                  
let        quote                                  

Now, CHARACTER in particular is a standard type. The hyperspec has a list of those as well, but I don't think there's a standard way to find all of the types programmatically.

Upvotes: 7

Related Questions