取表一部分 nth
;;除去表一部分;;(PartListRemove 2 3 '(1 2 3 4 5))
(defun PartListRemove (from to lst / I L)
(setq i -1)
(foreach x lst
(setq i (1+ i))
(cond ((or (< i from) (> i to)) (setq l (cons x l))))
)
(REVERSE l)
)
;;取表一部分
;;(PartList1 2 3 '(1 2 3 4 5))=>(3 4)
(defun PartList1 (from to lst / I L)
(setq i -1)
(foreach x lst
(setq i (1+ i))
(cond ((and (>= i from) (<= i to)) (setq l (cons x l))))
)
(REVERSE l)
)
;;取表一部分
;;(PartList2 2 3 '(1 2 3 4 5))=(3 4)
(defun PartList2 (from to lst / i L)
(setq i -1)
(mapcar '(lambda (x)
(setq i (1+ i))
(cond ((and (>= i from) (<= i to)) (setq l (cons x l))))
)
lst
)
(REVERSE l)
)
;;取表一部分
;;(PartList3 2 3 '(1 2 3 4 5))=(3 4)
(defun PartList3 (from to lst / I L X)
(setq i -1)
(while (and (setq x (car lst))
(setq lst (cdr lst))
(< i to)
)
(setq i (1+ i))
(cond((>= i from)(setq l (cons x l))))
)
(REVERSE l)
)
**** Hidden Message ***** 下载下来看看好用不 坐在沙发上学! 向长老学习! 老规矩,先回后下!!!!!!!
支持一下! 黄工看来是不可能戒掉LSP了.... 黄兄这个是用来做啥的? 正有需要啊..谢谢楼主 向黄老师学习! 看看隐藏啥也