What powerset() is really doing is producing all the sub-sequences (with gaps between elements allowed) of the input sequence. If your input sequence contains distinct elements, then you can think of it as being a set and think of all of the generated sub-sequences as subsets. That is, there is a correspondence between a sequence of distinct elements and the set consisting of those elements.
So, the powerset() routine can be used to produce either 1) all the sub-sequences of a given sequence or 2) all the subsets of a given set.
In reply to Re^2: Subsets and adjacent values
by pc88mxer
in thread Subsets and adjacent values
by andreas1234567
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |