✨ feat(tsl-api-reference): expand API and module coverage
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
# 数学函数 / 数值计算 / 其他
|
||||
|
||||
## `generateCombinations(list, ret, start, n, combine)`
|
||||
|
||||
声明:function
|
||||
|
||||
生成一维数组的全部非空组合
|
||||
|
||||
<!-- tags: 数学 组合 全组合 子集 combinatorics combination -->
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
| --------- | ------- | ---------------------------------- |
|
||||
| `list` | array | 输入的一维数组 |
|
||||
| `ret` | array | 接收生成的组合 |
|
||||
| `start` | integer | 可选。开始选取的位置,默认 0 |
|
||||
| `n` | integer | 可选。当前组合的写入位置,默认 0 |
|
||||
| `combine` | array | 可选。递归生成过程中使用的组合缓存 |
|
||||
|
||||
返回:integer
|
||||
|
||||
### 示例
|
||||
|
||||
范例01:生成三个元素的全部非空组合
|
||||
|
||||
```tsl
|
||||
list := array("a", "b", "c");
|
||||
ret := array();
|
||||
generateCombinations(list, ret);
|
||||
return ret;
|
||||
// 输出:
|
||||
// array(
|
||||
// ("a"),
|
||||
// ("a","b"),
|
||||
// ("a","b","c"),
|
||||
// ("a","c"),
|
||||
// ("b"),
|
||||
// ("b","c"),
|
||||
// ("c"))
|
||||
```
|
||||
Reference in New Issue
Block a user