Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the generic functions defined by the standard?

In Common Lisp there are a few generic functions defined by the standard, for instance functions to manipulate sequences.

However looking at Graham's book ANSI Common Lisp and Steele's book Common Lisp – The language at the relevant chapters, I could not find any list of the generic functions defined in the standard.

What are the generic functions defined by the standard?

like image 554
Michaël Le Barbier Avatar asked Dec 08 '25 08:12

Michaël Le Barbier


2 Answers

The question you asked

Functions that manipulate sequences are not generic-functions. They are listed in the section 17.3 The Sequences Dictionary.

All symbols specified by the standard are listed in the section 1.9 Symbols in the COMMON-LISP Package.

A partial list of standardized generic functions can be found in section 7.7 The Objects Dictionary (e.g., print-object is listed in section 22.4 The Printer Dictionary).

The question you might have meant to ask

Finding existing Lisp functionality should not be hard using apropos. Once you see a plausibly looking symbol, use describe to find out what it actually does.

Remember that most implementations offer more that the standard specifies. You can do something like this:

(dolist (pack (package-use-list "COMMON-LISP-USER"))
  (format t "~S~%" pack)
  (do-external-symbols (s pack)
    (when (and (fboundp s)
               (typep (fdefinition s) 'generic-function))
      (format t "  ~S~%" s))))
like image 182
sds Avatar answered Dec 09 '25 22:12

sds


I currently see no better way than to go through the pages of the CLHS Master Index and grep for "Generic Function".

Applying this suggestion a local copy of the HyperSpec using the script

% sed -n -e '
/Standard Generic Function/{
 s/.*Standard Generic Function *//
 s|</A>||
 p
}' X_Mast_*.htm | sort -u

yielded the following list

(SETF CLASS-NAME)
ADD-METHOD
ALLOCATE-INSTANCE
CHANGE-CLASS
CLASS-NAME
COMPUTE-APPLICABLE-METHODS
DESCRIBE-OBJECT
DOCUMENTATION, (SETF DOCUMENTATION)
FIND-METHOD
FUNCTION-KEYWORDS
INITIALIZE-INSTANCE
MAKE-INSTANCE
MAKE-INSTANCES-OBSOLETE
MAKE-LOAD-FORM
METHOD-QUALIFIERS
NO-APPLICABLE-METHOD
NO-NEXT-METHOD
PRINT-OBJECT
REINITIALIZE-INSTANCE
REMOVE-METHOD
SHARED-INITIALIZE
SLOT-MISSING
SLOT-UNBOUND
UPDATE-INSTANCE-FOR-DIFFERENT-CLASS
UPDATE-INSTANCE-FOR-REDEFINED-CLASS
like image 41
Svante Avatar answered Dec 10 '25 00:12

Svante