无聊中,弄个组合排列
(defun aa ( nmax nst / li )(repeat (- nmax nst)
(setq li (cons (setq nst (1+ nst)) li))
)
(REVERSE li)
)
(defun bb ( nst nmax n / ll )
(while (< nst nmax)
(if (= n 2)
(setq ll (cons (MAPCAR '(LAMBDA (x) (cons nst (if (listp x) x (list x)))) (aa nmax nst)) ll))
(setq ll (cons (MAPCAR '(LAMBDA (x) (cons nst x)) (bb (1+ nst) nmax (1- n))) ll))
)
(setq nst (1+ nst))
)
(apply 'append ll)
)
(defun asdf ( / li )
(princ "\n===li===\n")
(princ (setq li (vl-sort (MAPCAR '(LAMBDA (x) (vl-sort x '<)) (bb 1 20 4)) '(LAMBDA (x y) (< (car x) (car y))))))
(princ "\n===length===\n")
(princ (length li))
) 多谢楼主分享 这个程序是干嘛的好歹介绍一下啊 不知怎么用呢,有个例就好了或是演视图. 多谢楼主分享!用上了! 328302216 发表于 2014-9-24 16:40 static/image/common/back.gif
多谢楼主分享!用上了!
这也用上了?!什么情况,分享一下! 楼主 可否给个例子 这样回看得明白点。 (aa 10 2)得到(3 4 5 6 7 8 9 10)
(bb 2 10 4)得到((2 8 9 10) (2 7 9 10) (2 7 8 9) (2 7 8 10) (2 6 9 10) (2 6 8 9) (2 6 8 10) (2 6 7 8) (2 6 7 9) (2 6 7 10) (2 5 9 10) (2 5 8 9) (2 5 8 10) (2 5 7 8) (2 5 7 9) (2 5 7 10) (2 5 6 7) (2 5 6 8) (2 5 6 9) (2 5 6 10) (2 4 9 10) (2 4 8 9) (2 4 8 10) (2 4 7 8) (2 4 7 9) (2 4 7 10) (2 4 6 7) (2 4 6 8) (2 4 6 9) (2 4 6 10) (2 4 5 6) (2 4 5 7) (2 4 5 8) (2 4 5 9) (2 4 5 10) (2 3 9 10) (2 3 8 9) (2 3 8 10) (2 3 7 8) (2 3 7 9) (2 3 7 10) (2 3 6 7) (2 3 6 8) (2 3 6 9) (2 3 6 10) (2 3 5 6) (2 3 5 7) (2 3 5 8) (2 3 5 9) (2 3 5 10) (2 3 4 5) (2 3 4 6) (2 3 4 7) (2 3 4 8) (2 3 4 9) (2 3 4 10) (3 8 9 10) (3 7 9 10) (3 7 8 9) (3 7 8 10) (3 6 9 10) (3 6 8 9) (3 6 8 10) (3 6 7 8) (3 6 7 9) (3 6 7 10) (3 5 9 10) (3 5 8 9) (3 5 8 10) (3 5 7 8) (3 5 7 9) (3 5 7 10) (3 5 6 7) (3 5 6 8) (3 5 6 9) (3 5 6 10) (3 4 9 10) (3 4 8 9) (3 4 8 10) (3 4 7 8) (3 4 7 9) (3 4 7 10) (3 4 6 7) (3 4 6 8) (3 4 6 9) (3 4 6 10) (3 4 5 6) (3 4 5 7) (3 4 5 8) (3 4 5 9) (3 4 5 10) (4 8 9 10) (4 7 9 10) (4 7 8 9) (4 7 8 10) (4 6 9 10) (4 6 8 9) (4 6 8 10) (4 6 7 8) (4 6 7 9) (4 6 7 10) (4 5 9 10) (4 5 8 9) (4 5 8 10) (4 5 7 8) (4 5 7 9) (4 5 7 10) (4 5 6 7) (4 5 6 8) (4 5 6 9) (4 5 6 10) (5 8 9 10) (5 7 9 10) (5 7 8 9) (5 7 8 10) (5 6 9 10) (5 6 8 9) (5 6 8 10) (5 6 7 8) (5 6 7 9) (5 6 7 10) (6 8 9 10) (6 7 9 10) (6 7 8 9) (6 7 8 10) (7 8 9 10))
页:
[1]