users-prolog
[Top][All Lists]
Advanced

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

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


From: Duncan Patton a Campbell
Subject: Re: Users-prolog Digest, Vol 86, Issue 4
Date: Mon, 23 Aug 2010 10:10:17 -0600

On Mon, 23 Aug 2010 12:00:22 -0400
address@hidden 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



reply via email to

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