9 lines
305 B
Plaintext
9 lines
305 B
Plaintext
# Built-in
|
|
Combinations([1, 2, 3]);
|
|
# [ [ ], [ 1 ], [ 1, 2 ], [ 1, 2, 3 ], [ 1, 3 ], [ 2 ], [ 2, 3 ], [ 3 ] ]
|
|
|
|
# Note that it handles duplicates
|
|
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 ],
|
|
# [ 2 ], [ 2, 3 ], [ 3 ] ]
|