level 1
刚看到你这个帖子,虽然你可能不需要帮助了。
1、;(s '(a 2 3 (3 4 5 8))) --(2 4 8)
(defun s (lst)
(if (null lst)
nil
(if (atom (car lst))
(if (numberp (Car lst))
(if (evenp (car lst))
`(,(car lst) ,@(s (cdr lst)))
`(,@(s (cdr lst))))
`(,@(s (cdr lst))))
`(,@(s (car lst)) ,@(s (cdr lst))))))
2、;(s 1 '(1 2 (a 3 1) 4))--2
(defun s (x lst)
(if (null lst)
0
(if (equal x (Car lst))
(+ 1 (s x (cdr lst)))
(if (atom (car lst))
(+ 0 (s x (cdr lst)))
(+ (s x (car lst)) (s x (cdr lst)))))))
2015年01月24日 14点01分