在公共 lisp 中将结构传递给宏的类型错误

pri*_*cks 1 macros struct common-lisp typeerror

我有这个结构:

(defstruct (endpoint (:constructor create-endpoint (name tags values)))
  name tags values)
Run Code Online (Sandbox Code Playgroud)

还有这个宏:

(defmacro build-get-endpoint (server db-uri db endpoint)
  "constructs a get endpoint that returns all records in the measurement"
  (with-gensyms (uri-sym path-sym query-sym route-sym fields)
    `(let ((,fields (cons "time" (append (endpoint-tags ,endpoint)
                                         (endpoint-values ,endpoint))))
           (,uri-sym (quri:uri ,db-uri))
           (,path-sym (format nil "/~a" ,(endpoint-name endpoint)))
           (,query-sym (format nil "SELECT ~{~a~^, ~} FROM ~a"
                               ,fields ,(endpoint-name endpoint))))

       (setf (quri:uri-path ,uri-sym) "/query")
       (setf (quri:uri-query-params ,uri-sym)
             (list (cons "q" ,query-sym) (cons "db" ,db)))

       (define-route ,server ,path-sym :get
         (defview ,route-sym ()
           (vom:debug "sending query (~a) to influx" (quri:render-uri ,uri-sym))
           (call-influx (dex:get ,uri-sym)
                        (:no-error (body &rest args)
                                   (declare (ignore args))
                                   (respond (parse-get-response body)
                                            :type "application/json" :status 200))))))))
Run Code Online (Sandbox Code Playgroud)

但是当我尝试通过以下方式实际运行代码时:

(build-get-endpoint server (start-opts-db-uri starts)
                       (start-opts-db-name starts)
                       (create-endpoint "mood" nil '("value")))
Run Code Online (Sandbox Code Playgroud)

我收到一个类型错误,提示(create-endpoint "mood" nil '("value"))is not of type ENDPOINT

我究竟做错了什么?

Rai*_*wig 6

看: ,(endpoint-name endpoint)

这看起来像是在宏扩展时评估表达式。endpoint是代码,尚未评估。