- (define-specialization (NAME ARGUMENT ...) [RESULTS] BODY)syntax
Declares that calls to the globally defined procedure NAME with arguments matching the types given by ARGUMENTs should be replaced by BODY (a single expression). Each ARGUMENT should be an identifier naming a formal parameter, or a list of the form (IDENTIFIER TYPE). In the former case, this argument specializes on the * type. If given, RESULTS (which follows the syntax given above under "Type Syntax") adjusts the result types from those previously declared for NAME.
NAME must have a declared type (for example by using :). If it doesn't, the specialization is ignored.
User-defined specializations are always local to the compilation unit in which they occur and cannot be exported. When encountered in the interpreter, define-specialization does nothing and returns an unspecified result.
When multiple specializations may apply to a given call, they are prioritized by the order in which they were defined, with earlier specializations taking precedence over later ones.
There is currently no way of ensuring specializations take place. You can use the -debug o compiler options to see the total number of specializations performed on a particular named function call during compilation.