Next: Example Definitions, Previous: Defining Stack Commands, Up: Lisp Definitions
Anywhere a parameter name can appear in the parameter list you can also use an argument qualifier. Thus the general form of a definition is:
(defmath name (param param...
&optional param param...
&rest param)
body)
where each param is either a symbol or a list of the form
(qual param)
The following qualifiers are recognized:
For example,
(defmath foo (a (constp (not-matrixp b)) &optional (float c)
&rest (integer d))
body)
expands to
(defun calcFunc-foo (a b &optional c &rest d)
(and (math-matrixp b)
(math-reject-arg b 'not-matrixp))
(or (math-constp b)
(math-reject-arg b 'constp))
(and c (setq c (math-check-float c)))
(setq d (mapcar 'math-check-integer d))
body)
which performs the necessary checks and conversions before executing the body of the function.