### Optional and keyword parameters in generic functions

Posted:

**Mon Dec 29, 2008 1:20 pm**Is it possible to specialize and give a default value for an optional parameter in a generic function, i.e:

(defgeneric foo (one &optional two))

(defmethod foo ((one number) &optional (two number))

(+ one two))

This is read as though the optional parameter has a default value of number instead of specializing on the type number. I may be missing something obvious but

any help or a pointer to where this has been discussed would be greatly appreciated.

Thanks!

(defgeneric foo (one &optional two))

(defmethod foo ((one number) &optional (two number))

(+ one two))

This is read as though the optional parameter has a default value of number instead of specializing on the type number. I may be missing something obvious but

any help or a pointer to where this has been discussed would be greatly appreciated.

Thanks!