MathTop

list_multichoose 函数

返回允许重复使用位置的 k 元选择。

语法

  • list_multichoose(list, k)
  • combinations_with_replacement(list, k)

参数与选项

list形如 [1, 2, 3] 的列表字面量。
k选取的元素数量。

示例

  1. 可重复列表选择list_multichoose([x, y], 3)返回 [[x, x, x], [x, x, y], [x, y, y], [y, y, y]]。