[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Try this for ensure-generic-function:

ensure-generic-function <symbol>
                        &key (<generic-function-class>
                               (class-named 'standard-generic-function))
                             (make-exisiting-function-default-p nil)

If symbol is fboundp to a generic-function of the same class as
<generic-function-class> then this function does nothing.

If symbol is fboundp to a generic-function of some other class, the
generic-function class changing protocol is followed, see chapter 3.

If symbol not foundp a generic function of generic-function-class is
created and put in symbol's function cell.

If symbol is boundp to a function, and make-exisiting-function-default-p
is not nil, a generic-function is created, put in the function cell, a
default method is added to the generic-function and the symbol's
previous function cell value is used as the function for the default

If symbol is fboundp to a function and make-exisiting-function-default-p
is nil an error is signalled.

If symbol names a macro or a special form, an error is signalled.

Feel free to change the names of the arguments.  Note that this is a
function not a generic-function.