my perm/2 is not commutative
- From: "Anders Lindén" <xxxx@xxxxxx>
- Date: Fri, 13 May 2005 08:32:43 +0200
Hello!
I have written a permutation relation that is like this:
perm([],[]).
perm(L,[A|B]):- insert(A,X,L), perm(X,B).
It works in one direction:
perm([1,2,3],X).
but not in this direction:
perm[X,[1,2,3]).
....then it will produce one solution and enter an eternal loop.
How can I write my perm relation more general?
/Anders
.
- Follow-Ups:
- Re: my perm/2 is not commutative
- From: Kral Stefan
- Re: my perm/2 is not commutative
- Prev by Date: Re: deductive databases
- Next by Date: Adding to the end of a list
- Previous by thread: Re: deductive databases
- Next by thread: Re: my perm/2 is not commutative
- Index(es):