Julia 中长度有限的排列

Permutations with a limited length in Julia

在 Python 中,您可以使用 itertools 生成如下排列:

>>> list(itertools.permutations("ABC", 2))
[('A', 'B'), ('A', 'C'), ('B', 'A'), ('B', 'C'), ('C', 'A'), ('C', 'B')]

Julia 有一个类似的 permutations 函数,但它只接受一个参数。模拟 Python 函数中第二个参数的最佳方法是什么?

subsets from Iterators.jl with k=2 应该得到大小为 2 的每个子集,然后你可以获取子集的每个排列。