Gprolog member/2 error ?!

Pedro Fialho <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <[email protected]>
Hi all,

I found a strange error on my gprolog coding, namely on the source:

pred1([R-C-P|Ls], [R-C-P|Ls1]):-
    memberchk(rel(_,X,Y), C),
    memberchk(rel(_,Y,_), C),
    nth(1,P,Z),
    ...

I get the debug output:

...call pred1...

   6913    3  Call: 
   memberchk(
		rel(_215226,_215227,_215228),
		['conclusao'(_198617),'diagnostico'(_198661),
		 paciente(_198705),nome(_198705,'Rita Ambrosio'),
		 rel(de,_198617,_198661),rel(para,_198617,_198705)
		]
	) ? 
   6913    3  Exit: 
   memberchk(
		rel(de,_198617,_198661),
		['conclusao'(_198617),'diagnostico'(_198661),
		 paciente(_198705),nome(_198705,'Rita Ambrosio'),
		 rel(de,_198617,_198661),rel(para,_198617,_198705)
		]
	) ? 
   6914    3  Call: 
   memberchk(
		rel(_215255,_198661,_215257),
		['conclusao'(_198617),'diagnostico'(_198661),
		 paciente(_198705),nome(_198705,'Rita Ambrosio'),
		 rel(de,_198617,_198661),rel(para,_198617,_198705)
		]
	) ? 
   6914    3  Exit: 
   memberchk(
		rel(de,_198617,_198617),
		['conclusao'(_198617),'diagnostico'(_198617),
		 paciente(_198705),nome(_198705,'Rita Ambrosio'),
		 rel(de,_198617,_198617),rel(para,_198617,_198705)
		]
	) ? 
 + 6915    3  Call: nth(1,[ser(_198749,a:_198617)],_215322) ? 
 ...

 
 Also tried with member/2 but the List is always changed on exit of the 
 secound call to member/2. Notice the rel(de,_198617,_198661) predicate
 is changed to rel(de,_198617,_198617) although member/2 is not stated
 as a destructive process.
 
 Although my rel/3 predicate contains a literal and 2 prolog variables
 I'd like to compare variable instances, as stated on the above source.

 Any help ?
 
 
Greetings,
Peter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.