自贡黄明儒 发表于 2014-9-5 14:14:22

取表一部分 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 *****

水仙的错 发表于 2019-9-17 12:41:40

下载下来看看好用不

vlisp2012 发表于 2014-9-5 14:40:33

坐在沙发上学!

smartstar 发表于 2014-9-5 14:58:57

向长老学习!

fan_zh 发表于 2014-9-5 15:01:15

老规矩,先回后下!!!!!!!

USER2128 发表于 2014-9-5 15:08:40

支持一下!

q3_2006 发表于 2014-9-5 15:29:12

黄工看来是不可能戒掉LSP了....

haoryh 发表于 2014-9-5 16:47:11

黄兄这个是用来做啥的?

xujinhua 发表于 2014-9-5 16:51:43

正有需要啊..谢谢楼主

yoyoho 发表于 2014-9-5 17:09:23

向黄老师学习!

wzg356 发表于 2014-9-5 17:58:33

看看隐藏啥也
页: [1] 2 3 4 5 6 7
查看完整版本: 取表一部分 nth