试试
- (defun samecount (lst / a b n)
- (while lst
- (setq n (length lst)
- a (car lst)
- lst (vl-remove a lst)
- b (cons (cons a (- n (length lst))) b)
- )
- )
- )
- (defun delsame (lst / a b)
- (while (setq a (car lst))
- (if
- (vl-position a b)
- nil
- (set 'b (cons a b))
- )
- (setq lst (cdr lst))
- )
- (setq b (reverse b))
- b
- )
- (defun tt (lst from to / a n lst1)
- (setq a (samecount lst)
- lst (delsame lst)
- n (- to from)
- )
- (repeat (1+ n)
- (if (not(member from lst))
- (setq lst1 (cons from lst1))
- )
- (setq from (1+ from))
- )
- (list (vl-remove-if '(lambda (x) (= 1 (cdr x))) a)
- (reverse lst1)
- )
- )
(tt '(1 2 3 5 7 9 1 2) 1 11)=>(((2 . 2) (1 . 2)) (4 6 8 10 11))
|