PLEASE HELP QUICK!!!!! 
Author Message
 PLEASE HELP QUICK!!!!!

I need an intersection function for Prolog that accepts two lists of any
kind.  I am using Strawberry Prolog compiler, if that helps.  Can anybody
tell me where to find one, or just give me one.

Thanks in advance for any help.



Sun, 30 Dec 2001 03:00:00 GMT  
 PLEASE HELP QUICK!!!!!

Brian Norwood a crit dans le message ...

Quote:
>I need an intersection function for Prolog that accepts two lists of any
>kind.  I am using Strawberry Prolog compiler, if that helps.  Can anybody
>tell me where to find one, or just give me one.

>Thanks in advance for any help.

% intersection(Xs, Ys, Zs) is true if Zs is a list containing the set of
%   elements in the intersection of the sets of elements in lists Xs and
%   Ys.  The elements in Zs are in the same order as they are in Xs.
intersection([], _, []).
intersection([X|Xs], Ys, Zs):-
  member(X, Ys), !, Zs = [X|Ws], intersection(Xs, Ys, Ws).
intersection([_|Xs], Ys, Zs):-intersection(Xs, Ys, Zs).

--
Colin


Internet: http://perso.wanadoo.fr/colin.barker



Mon, 31 Dec 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Quick Time help, PLEASE...

2. ** PLEASE - NEED HELP REAL QUICK **

3. quick newbie question, please help, .bmp of code attached - code.bmp [0/4]

4. please, please, please, please, help

5. will someone please, please, please, please HELP me?!!

6. VSE 3.1 Repository Problem: Please help (please please?)

7. PLEASE PLEASE PLEASE HELP !!!!!!!!!!!!

8. please,please please do help us

9. help please-----please help about array in DLL

10. HELP !..PLEASE,PLEASe,PLEAse,PLEase,PLease,Please,please.....

11. quick newbie question on variables. please answer

12. Quick feedback no Tcl footprint, please

 

 
Powered by phpBB® Forum Software