Re: Users-prolog Digest, Vol 86, Issue 4

Duncan Patton a Campbell <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Organization NeoText
Message-ID <[email protected]>
On Mon, 23 Aug 2010 12:00:22 -0400
[email protected] wrote:

> 
> 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 see no cut in this code snip, implying the potential for
backtracking either here or further on.  From the manual:

"
member(Element, List) succeeds if Element belongs to the List. This predicate is re-executable on backtracking and can be thus used to enumerate the elements of List.

memberchk/2 is similar to member/2 but only succeeds once.

 "

Dhu
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.