I am new to Prolog and I'm trying out list permutation predicates.
Most of them take two arguments (e.g., permutation/2
).
I'm looking to create one which only takes one argument (list) and also finds out if the list has exactly 10 elements.
So for example:
| ?- permutation([7, 1, 2, 3, 4, 5, 6, 0, 8, 9]).
yes
| ?- permutation(X).
X = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
...
| ?- permutation([A,B,C,D,E,F,G,H,I,J]).
A = 0
B = 1
C = 2
...
J = 9 ;
Appreciate any tips!