本帖最后由 自贡黄明儒 于 2018-8-8 08:39 编辑
 - (setq L '((1 2) ((3 4) (5 6)) (7 8) (((9 10) (11 12)) (13 14))))
- (defun ww (L / A LST)
- (while L
- (setq a (car L))
- (setq L (cdr L))
- (if (= (type a) 'LIST)
- (setq L (append a L))
- (setq Lst (cons a Lst))
- )
- )
- (reverse Lst)
- )
第二种: - ;;(WW '((1 2) ((3 4) (5 6)) (7 8) (((9 10) (11 12)) (13 14)))) => (1 2 3 4 5 6 7 8 9 10 11 12 13 14)
- ;;(WW '(1 2 3)) => (1 2 3)
- (defun ww (L / A LST)
- (if L
- (progn
- (setq a (car L))
- (if (= (type a) 'LIST)
- (append (ww a) (ww (cdr L)))
- (cons a (ww (cdr L)))
- )
- )
- )
- )
|