Power set: Difference between revisions
Content added Content deleted
(adding gap) |
|||
Line 663: | Line 663: | ||
=={{header|GAP}}== |
=={{header|GAP}}== |
||
<lang gap># Built-in |
<lang gap># Built-in |
||
Combinations([1,2,3]); |
Combinations([1, 2, 3]); |
||
# [ [ ], [ 1 ], [ 1, 2 ], [ 1, 2, 3 ], [ 1, 3 ], [ 2 ], [ 2, 3 ], [ 3 ] ] |
# [ [ ], [ 1 ], [ 1, 2 ], [ 1, 2, 3 ], [ 1, 3 ], [ 2 ], [ 2, 3 ], [ 3 ] ] |
||
# Note that it handles duplicates |
# Note that it handles duplicates |
||
Combinations([1,2,3,1]); |
Combinations([1, 2, 3, 1]); |
||
# [ [ ], [ 1 ], [ 1, 1 ], [ 1, 1, 2 ], [ 1, 1, 2, 3 ], [ 1, 1, 3 ], [ 1, 2 ], [ 1, 2, 3 ], [ 1, 3 ], |
# [ [ ], [ 1 ], [ 1, 1 ], [ 1, 1, 2 ], [ 1, 1, 2, 3 ], [ 1, 1, 3 ], [ 1, 2 ], [ 1, 2, 3 ], [ 1, 3 ], |
||
# [ 2 ], [ 2, 3 ], [ 3 ] ] |
# [ 2 ], [ 2, 3 ], [ 3 ] ]</lang> |
||
=={{header|Go}}== |
=={{header|Go}}== |