Skip to content

Esta página también está en español.

Léela en español

このページは日本語でも読めます。

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

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])=[[],[1],[2],[3],[1,2],[1,3],[2,3],[1,2,3]]\displaystyle \operatorname{subsets}(\left[ 1, 2, 3 \right]) = \left[ \left[ \right], \left[ 1 \right], \left[ 2 \right], \left[ 3 \right], \left[ 1, 2 \right], \left[ 1, 3 \right], \left[ 2, 3 \right], \left[ 1, 2, 3 \right] \right]
    subsets([1, 2, 3])

    In the solver, subsets([1, 2, 3]) gives [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]].

    Open in the solver
  • 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.