摘要:
(defun single? (lst) (and (consp lst) (null (cdr lst)))) CL-USER> (single? nil)NILCL-USER> (single? '(a))T (defun append1 (lst obj) (append lst (list obj))) CL-USER> (append1 '(a b c d) 'e)(A B C D ... 阅读全文
posted @ 2012-12-20 22:10
flowjacky
阅读(224)
评论(0)
推荐(0)
摘要:
a.如果在一般形参前CL-USER> (defun hey (x &rest args) (member x args))HEYCL-USER> (hey '1 '(2 1 3))NILCL-USER> (hey '1 '2 '1 '3)(1 3)CL-USER> (member '1 '(2 1 3))(1 3)CL-USER> (defun world (&rest fn) fn)WORLDCL-USER> (world 'a 'b)(A B)CL-USER& 阅读全文
posted @ 2012-12-20 14:37
flowjacky
阅读(199)
评论(0)
推荐(0)
摘要:
do: (do ((x a (b x)) (y c (d y))) ((test x y) (z x y)) (f x y)) 局部函数: (labels ((rec (x y) (cond ((test x y) (z x y)) (t (f x y) (rec (b x) (d y)))))) (rec a c)) 说明:上面代码中的b,d,test,z,f均为函数。 阅读全文
posted @ 2012-12-20 11:35
flowjacky
阅读(140)
评论(0)
推荐(0)

浙公网安备 33010602011771号