Vin*_*inn 1 function common-lisp
我正在使用 dexator 来执行发布请求。我正在更新联系人数据库。
这是我的代码:
(defun upload-post (firstname email &optional first-line)
(dex:post NEW-LEAD-URL
:headers '((:content-type . "application/json"))
:content '(("email" . 'email)
("first_name" . firstname)
("custom_attributes" . '(("first_line" . first-line))))))
Run Code Online (Sandbox Code Playgroud)
firstname, email and first-line我收到已定义但未使用的错误。
请注意,我测试了引用email. 那行不通。
为什么参数被忽略?
因为引用列表 ( email, firstname, first-line) 内的符号不会计算。
Quote ( ') 停止所有计算,因此变量firstname、email和的值first-line不会被使用,您将发送一个请求,其中"email"has value email、"first_name"has valuefirstname等等。
list您可以使用and创建该请求列表cons,以便正确评估所有符号,或者使用反引号和逗号:
(defun upload-post (firstname email &optional first-line)
(dex:post NEW-LEAD-URL
:headers '((:content-type . "application/json"))
:content `(("email" . ,email)
("first_name" . ,firstname)
("custom_attributes" . (("first_line" . ,first-line))))))
Run Code Online (Sandbox Code Playgroud)
请注意,您的命名不一致firstname- vs first-line。