我正在尝试用 lisp 编写子集和问题。示例:(subsetsum '(1 2 3) 5)
= (2 3)
,(subsetsum '(1 5 3) 2)
= nil
。
我只能使用函数
(atom x)
(null x)
(eq x y)
(equal x y)
(numberp x)
(append x y)
(car x)
(cdr x)
(cons x y)
(if x y z)
(cond ... )
(let ((x y) (u v)) z)
(let* ((x y) (u v)) z)
(defun ...)
(quote x) and its short form 'x
(list x1 x2 ...)
(print ...)
(sort L fun)
我能得到任何提示吗?