gpt4 book ai didi

list - Lisp 中的 (list ...) 与 '(...)

转载 作者:太空宇宙 更新时间:2023-11-03 18:57:07 27 4
gpt4 key购买 nike

<分区>

当我有一个函数定义 make-cd 并执行该函数时得到了错误的答案。

(defun make-cd (title artist rating ripped)
'(:title title :artist artist :rating rating :ripped ripped))

(add-record (make-cd "Roses" "Kathy Mattea" 7 t))

(:TITLE TITLE :ARTIST ARTIST :RATING RATING :RIPPED RIPPED)

我应该使用 (list ...) 来获得正确答案。

(defun make-cd (title artist rating ripped)
(list :title title :artist artist :rating rating :ripped ripped))

(add-record (make-cd "Roses" "Kathy Mattea" 7 t))

(:TITLE "Roses" :ARTIST "Kathy Mattea" :RATING 7 :RIPPED T)

这是为什么?

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com