"fireblade" <········@YAHOO.COM> writes:
> Anyone can suggest some combinatorical library ,generating
> permutations, combinations & variations.
My package COM.INFORMATIMAGO.COMMON-LISP.COMBINATION
implements the following classes:
ARRANGEMENT-SANS-REPEAT
ARRANGEMENT-WITH-REPEAT
COMBINATION
They can generate a prefix of the resulting set even if there's no
time to finish it before Milliways.
Also these algorithms being simplistic,
(defun variations (item list)
(if (null list)
(list (list item))
(cons (cons item list)
(mapcar (lambda (rest) (cons (car list) rest))
(variations item (cdr list))))))
(defun permutations (elements)
(cond
((null elements) (list elements))
((null (cdr elements)) (list elements))
(t (mapcan (lambda (subperm) (variations (car elements) subperm))
(permutations (cdr elements))))))
there's no real reason to put them in a library: each application will
have additionnal constraints motivating variations on them.
http://www.informatimago.com/develop/lisp/index.html
--
__Pascal Bourguignon__ http://www.informatimago.com/
"Specifications are for the weak and timid!"