久不久投放一颗深水炸弹:)- ;|(xl_div lst nom)表分段. -> 返回 分段的表. ------by 无痕.2004.1
- ; lst = 表,nom = 分段的子表元素个数(从1开始计).
- ; 测试: (xl_div '(1 2 3 4 5 6 7 8 9) 3) -> ((1 2 3) (4 5 6) (7 8 9))
- (xl_div '(1 2 3 4 5 6 7 8 9 10 11) 3) -> ((1 2 3) (4 5 6) (7 8 9) (10 11))
- (xl_div '(17086.8 5666.8 0.0 16093.0 8693.12 0.0 16093.0 7827.36 0.0 16093.0 6639.13 0.0) 3)
- -> ((17086.8 5666.8 0.0) (16093.0 8693.12 0.0) (16093.0 7827.36 0.0) (16093.0 6639.13 0.0))
- (xl_div nil 2) -> nil
- |;;方法7. ok!**************************************************
- (defun xl-div (lst x / lst2)
- (foreach n lst
- (if (and lst2 (/= x (length (car lst2))))
- (setq lst2 (cons (append (car lst2)(list n))(cdr lst2)))
- (setq lst2 (cons (list n) lst2))
- )
- )(reverse lst2)
- )
|