powerset 函数
返回列表、集合或整数范围 1..n 的所有子集。
语法
powerset(list)powerset(n)power_set(list)combinat:-powerset(list)combinat[powerset](list)
参数与选项
list | 形如 [1, 2, 3] 的列表字面量。 |
|---|
示例
- 幂集
powerset([x, y])返回 [[], [x], [y], [x, y]]。 - 整数范围幂集
powerset(3)返回 [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]。 - 包式调用
combinat:-powerset([x, y])返回 [[], [x], [y], [x, y]]。