只需一步,快速开始
使用道具 举报
我回复了
(defun tt(o / i n j)(while (< (1+ (setq i (if (not i) -1 (1+ i)))) (length o))(while (= j (setq j (nth (setq i (1+ i)) o))))(setq n (append n (list j))))(cons (car o) n))
命令: (tt '(a b c c c d c o))(A B C D O)
qjchen发表于2009-7-27 17:48:00:)一写的很烂的代码,你试试看行不,只能1维消重,多维的大概得递归吧(defun test(lst / lst1 i res) (setq lst1 (cons (list (car lst)) lst) i -1) (foreach x lst (setq i
测试结果如下:
(rem-adj2 '(nil nil 1 2 3 3 3 3 32 1 1 1 nil nil))(nil 1 2 3 32 1 nil)
(defun test (lst / a lst2) (while (setq a (car lst) lst2 (cons a lst2) lst (vl-remove a lst))) (reverse lst2) )
(test '(a b c c c d c o))
(a b c d o)
本版积分规则 发表回复 回帖后跳转到最后一页
小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 ) ©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途
GMT+8, 2025-5-23 12:33 , Processed in 0.204105 second(s), 28 queries , Gzip On.
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.