0

我想将 1:3 的所有排列作为字符串。

julia> string.(permutations(1:3)...) # 1:3 is for the example, the real problem is larger
3-element Vector{String}:
 "112233"
 "231312"
 "323121"

但是结果是我想要的“转置”

6-element Vector{String}:
 "123"
 "132"
 "213"
 "231"
 "312"
 "321"

这个向量将是其他一些(向量化)函数调用的输入F.(perms),我想有效地做到这一点。我该怎么做?

4

1 回答 1

2

做就是了:

julia> join.(permutations(1:3),"")
6-element Vector{String}:
 "123"
 "132"
 "213"
 "231"
 "312"
 "321"
于 2021-03-18T17:08:40.430 回答