Re: Boundary conditions

Bengbers <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
Hi,Changing uniques_*L*ist to uniques_*l*ist did the trick. Without any
further change "uniques_list( [1,2,3,4], [ 4,5,6], X)" returns "X = [6,5]"
Thanks for this correction.
2 uniques_list( Control, [H|Tail], Accu, Unique) :-    \+member( H,
Control), Accu2=[H|Accu], uniques_list( Control, Tail,Accu2, Unique).
3 uniques_list( Control, [_|Tail], Accu, Unique) :-    uniques_list(
Control, Tail, Accu, Unique).
 
You say that clause 2 and 3 overlap and leave a choice point. I doubt this.
\+member( H, Control) from clause 2 fails when H is member from Control so
Prolog jumps to the next clause.
Clause 3 is not interested in H and then passes control to clause 2.
I copied this approach from one of the examples I found in '' 99 Problems in
Prolog, https://prof.ti.bfh.ch/hew1/informatik3/prolog/p-99/"
Ben



--
View this message in context: http://swi-prolog.996271.n3.nabble.com/Boundary-conditions-tp13445p13453.html
Sent from the SWI Prolog mailing list archive at Nabble.com.
-------------- next part --------------
HTML attachment scrubbed and removed
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.