In CLOS, how to specify that a method argument is a list of (e.g.) strings?
e.g. something like:
(defmethod m1 ((x (every 'string))) (dolist (y x) (print (char y 0))))
You can't. Methods can only be specialized on classes, not types. You could manually define the type list-of-strings with deftype and satisfies, but it would still be invalid to use it as a specializer in a defmethod.
list-of-strings
deftype
satisfies
defmethod.
From the defmethod entry of the CLHS:
Only required parameters can be specialized. If parameter-specializer-name is a symbol it names a class.
You can't. Methods can only be specialized on classes, not types. You could manually define the type
list-of-stringswithdeftypeandsatisfies, but it would still be invalid to use it as a specializer in adefmethod.From the defmethod entry of the CLHS: