Permutations Assignment 1

Disclaimer: Dieser Thread wurde aus dem alten Forum importiert. Daher werden eventuell nicht alle Formatierungen richtig angezeigt. Der ursprüngliche Thread beginnt im zweiten Post dieses Threads.

Permutations Assignment 1
I have a question regarding problem 1.1.3 myPermutations:
Is the function supposed to take duplicates into account or is a naive implementation of permutations sufficient?

For example is it ok for

?- myPermutations([1, 2, 2], X).

to output

X = [1, 2, 2]
X = [2, 1, 2]
X = [2, 2, 1]
X = [1, 2, 2]
X = [2, 1, 2]
X = [2, 2, 1]

or does it have to be

X = [1, 2, 2]
X = [2, 1, 2]
X = [2, 2, 1]

Thanks in advance.


Sorry about the late reply - we’ll count both solutions as correct.