subsets function
All the sublists of a list that keep its order, as a list.
How to write it
subsets(list)
- list
- The list. Takes a list.
Examples
subsets([1, 2, 3])In the solver,
Open in the solversubsets([1, 2, 3])gives[[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]].
Related functions
- table
Build a list by evaluating an expression over one or more ranges.
- sort
A list in increasing order.
- take
The first elements of a list.
- select
The elements of a list for which a test holds.
- tally
How often each element occurs: a list of element and count pairs.
- rotate_right
A list with its elements moved to the right, the last ones going to the front.