Skip to content

list:permutations returns combinations rather than permutations #51

@edsrzf

Description

@edsrzf

What happened?

The example for list:permutations seems incorrect, like it's giving combinations rather than permutations:

(let data [0 1 2 3])
(list:permutations data 3 (fun (perm) (print perm)))
# [0 1 2]
# [0 1 3]
# [0 2 3]
# [1 2 3]

I expect 24 results:

[0 1 2]
[0 1 3]
[0 2 1]
[0 2 3]
[0 3 1]
[0 3 2]
[1 0 2]
[1 0 3]
[1 2 0]
[1 2 3]
[1 3 0]
[1 3 2]
[2 0 1]
[2 0 3]
[2 1 0]
[2 1 3]
[2 3 0]
[2 3 1]
[3 0 1]
[3 0 2]
[3 1 0]
[3 1 2]
[3 2 0]
[3 2 1]

What ArkScript version are you seeing the problem on?

v4.3.3

Operating System

Linux

Compiler used

None

Compiler version used

No response

Relevant code & log output

Documentation

  • I have read existing related documentation before submitting this report
  • I have searched for an existing issue before posting

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions