- (defun xyp-List-DivFB (lst n / b i tmp)
- "xyp-List-DivFB 表首尾连续取值生成新表 (xyp-List-DivFB lst表 n子表内数量)"
- "(xyp-List-DivFB '(1 2 3 4 5 6) 7) → ((1 2 3) (2 3 4) (3 4 5) (4 5 6) (5 6 1) (6 1 2))"
- (setq i 0
- tmp '()
- )
- (repeat (1- n)
- (setq lst (append lst (list (nth i lst)))
- i (1+ i)
- )
- )
- (while (>= (length lst) n)
- (setq i 0
- b '()
- )
- (repeat n
- (setq b (cons (nth i lst) b)
- i (1+ i)
- )
- )
- (setq tmp (cons (reverse b) tmp)
- lst (cdr lst)
- )
- )
- (reverse tmp)
- )
|