users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Constraining two vectors to be different


From: LECONTE Jean Michel
Subject: Re: Constraining two vectors to be different
Date: Tue, 1 Jul 2003 22:43:43 +0200
User-agent: Internet Messaging Program (IMP) 3.0

a possible solution is that you construct the goal you want at the runtime :


% with vectDif2 you construct the goal
vectDif2([],[],1#=2).  % not very nice i know
vectDif2([A|L],[C|L2],G):- 
        vectDif2(L,L2,G2),
         G= ((A#\= C) #\/ G2). 

vectDif(V1,V2):-
        vectDif2(V1,V2,G), % you construct the goal
        G.   % you call it


hope that will aide you

Jean Michel

Quoting Thomas Bourdeaud'huy <address@hidden>:

> Yes, but the problem is that the size of vectors may change with the
> applications ...
> 
> Is it possible to define a predicate like : 
> 
> vectDif([],[]).
> vectDif([E1|R1],[E2|R2]):-
>       (E1 #\= E2) #\/ vectDif(R1,R2). 
> 
>       I have tried but Gprolog doesn't like the second member ...
> 
> 
> Or anything defined with a negation : not(Vect1 #= Vect2) for example ? 
> 
> Thanks
> 
> Thomas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]