list_permutations 函数
返回列表中不重复使用位置的有序 k 元排列。
语法
combinat:-permute(list, k)list_permutations(list, k)permute(list, k)
参数与选项
list | 形如 [1, 2, 3] 的列表字面量。 |
|---|---|
k | 每个排列中的元素个数。 |
示例
- 二元排列
combinat:-permute([x, y, z], 2)返回 [[x, y], [x, z], [y, x], [y, z], [z, x], [z, y]]。