Function: %MAKE-MATCHER

Source

(defun %make-matcher (spec)
  ;; NIL means many different things, deal with it explicitly
  (if (eql nil spec)
      (%make-matcher `(:eql ,spec))
      (if (listp spec)
          (aif (get-match-handler (car spec))
               (apply it (cdr spec))
               (error "Don't know how to handle ~S" spec))
          (aif (get-match-handler spec)
               ;; we allow :x as a an abbreviation for (:x)
               (funcall it)
               (if (and (symbolp spec)
                        (not (keywordp spec)))
                   (%make-matcher `(:bind :anything ,spec))
                   (if (constantp spec)
                       (%make-matcher `(:eql ,spec))
                       (error "Don't know how to deal with ~S" spec)))))))
Source Context