Documentation Prolog Predicate Reference lists permutation/2

permutation/2

Permutation of list.

Description

permutation( ?list, ?list )

permutation(List, PermutateList) is true if and only if PermutateList is a permutation of List. If one of those parameters is uninstantiated, permutation/3 will calculate all the possible permutations. PermutateList can be also specified as a list of variables so, on each choice point, these variables are instantiated to individual values. It's important to keep in mind that this predicate is computationally expensive, since a list of T length has T! permutations.

Implementation