我正在尝试编写一个将元素添加到给定 powerset 的每个元素的函数。不管它总是将 (null pset) 评估为真。我不明白为什么。
这是我到目前为止所拥有的:
(defun addxtopowerset(x pset)
(cond
((null pset) (list x '())) ; If the powerset is null, display x and NIL.
;;First display a list combining x and the first item of pset. Then display the first item of pset itself. Then recursively call the function passing the rest of pset as a parameter.
(T (list 'x (car pset))(list (car pset))
(addxtopowersetch x (cdr pset)))))