Prolog permutation predicate using insertion of elements
问题 I am trying to write a predicate permutation/2 so that it is true if and only if both arguments are list, one a permutation of the other. To do this, I've written the two helper predicates delete/3 and insert/3 . The first is true if and only if the third argument is the second argument, both lists, with the first instance of the element in the first argument removed. The second is true if and only if the third argument equals the second argument with the first argument (element) inserted.