calc: Argument Qualifiers

 
 18.5.4 Argument Qualifiers
 --------------------------
 
 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:
 
 ‘complete’
      The argument must not be an incomplete vector, interval, or complex
      number.  (This is rarely needed since the Calculator itself will
      never call your function with an incomplete argument.  But there is
      nothing stopping your own Lisp code from calling your function with
      an incomplete argument.)
 
 ‘integer’
      The argument must be an integer.  If it is an integer-valued float
      it will be accepted but converted to integer form.  Non-integers
      and formulas are rejected.
 
 ‘natnum’
      Like ‘integer’, but the argument must be non-negative.
 
 ‘fixnum’
      Like ‘integer’, but the argument must fit into a native Lisp
      integer, which on most systems means less than 2^23 in absolute
      value.  The argument is converted into Lisp-integer form if
      necessary.
 
 ‘float’
      The argument is converted to floating-point format if it is a
      number or vector.  If it is a formula it is left alone.  (The
      argument is never actually rejected by this qualifier.)
 
 ‘PRED’
      The argument must satisfy predicate PRED, which is one of the
      standard Calculator predicates.  SeePredicates.
 
 ‘not-PRED’
      The argument must _not_ satisfy predicate PRED.
 
    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.