Hi,
if I wan't to generate & print out all combinations of N elements,
each combination K elements long, how can I do it , in the simplest
posible way in Lisp.( I really need the simplest algorithm, not the most
efficient )
10x in advance for bothering to answer this question.
Stanimir Peev
Centuries ago, Nostradamus foresaw a time when Stanimir Peev would say:
>if I wan't to generate & print out all combinations of N elements,
>each combination K elements long, how can I do it , in the simplest
>posible way in Lisp.( I really need the simplest algorithm, not the most
>efficient )
>
>10x in advance for bothering to answer this question.
When is the assignment due? And what is the email address of the
instructor? My preference would be to submit the solution directly to
ensure proper attribution of academic credit.
--
Rules of the Evil Overlord #69. "The deformed mutants and odd-ball
psychotics will have their place in my Legions of Terror. However
before I send them out on important covert missions that require tact
and subtlety, I will first see if there is anyone else equally
qualified who would attract less attention."
<http://www.eviloverlord.com/lists/overlord.html>
········@hex.net - - <http://www.hex.net/~cbbrowne/lisp.html>
Stanimir Peev wrote:
>
> Hi,
> if I wan't to generate & print out all combinations of N elements,
> each combination K elements long, how can I do it , in the simplest
> posible way in Lisp.( I really need the simplest algorithm, not the most
> efficient )
This is simple, and "not the most efficient":
Print all the permutations of N elements, and
pipe the output through "cut -f" and "sort -u".