Re: negotiation by failure- list operations



the problem with the empty list is just a minor one - its simply
delete1(_,[],[]).

but thats not what my question was.

The problem is still- how to find out that X isnt in L1 and then to
throw a YES - can this be solved by a not(member/2) predicate ??

any suggestions highly appreciated

greetings
ne0

Brian Hulley schrieb:
> ne0 wrote:
> > hi, what im trying to do is the following:
> >
> >
> > delete1(X,L1,L2) that uses delete(X,L1,L2) but if X isnt in L1 it
> > should not throw NO - it should only throw YES
> >
> > i think its donesimilar to that predicate:
> > different(X,Y) :- X=Y, !, true.
> > different(X,Y).
> >
> > but how do i change my delete1 predicate that it throws YES if X isnt
> > in L1 ?
> >
> >
> > Can someone help me ?
>
> You need to catch the case where you are trying to delete X from an
> empty list so that this case succeeds instead of failing. Hint: there
> should be 3 clauses for delete1...
>
> Hope this helps - best regards Brian.

.