From i960242@dei.isep.ipp.pt  Tue Dec 19 15:15:31 2000
Received: from groucho.dei.isep.ipp.pt (root@groucho.dei.isep.ipp.pt [193.136.62.4])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id PAA22330
	for <prolog@swi.psy.uva.nl>; Tue, 19 Dec 2000 15:15:30 +0100 (MET)
Received: from pci014 (pci014.dei.isep.ipp.pt [193.136.62.213])
	by groucho.dei.isep.ipp.pt (8.9.1a/DEINET-1.1) with SMTP id OAA21858
	for <prolog@swi.psy.uva.nl>; Tue, 19 Dec 2000 14:16:14 GMT
Message-Id: <SAK.2000.12.19.kglkmmms@pci014>
Date: Tue, 19 Dec 2000 15:16:51 GMT
X-Priority: 3
From: Nuno Baptista <i960242@dei.isep.ipp.pt>
X-Mailer: Mail Warrior
To: prolog@swi.psy.uva.nl
MIME-Version: 1.0
Subject: FW:Re:  [SWIPL] Prolog help
Content-Type: Text/Plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8Bit
X-Mailer-Version: v3.57



Original message from: Nuno Baptista
>The algorithm is supposed to give me a list of possible bus that i can get into, to go from "Origem" to 
"Destino".
>I already have all the possible links between places and their bus.
>
>I would like to thanks the time you've spend explaining me your intersection algorithm. You see, i'm just 
starting 
>with prolog, and i can use all the help i can get. 
>										Nuno Baptista
>
>autocarro('Pr. Liberdade',[1,7,91,33,83,15,19,76,54]).
>ligacao('Pr. Liberdade',['Serra Pilar','S. Domingos','Carmo','Av. Aliados']).
>
>percurso(Origem,Destino,[L|T]):-
>	autocarro(Origem,LA1),
>	ligacao(Origem,LO),
>	member(NO,LO),
>	autocarro(NO,LA2),
>	interseccao(LA1,LA2,L),
>	percurso(NO,Destino,L).
>percurso(Destino,Destino,[]).
>	
>/*Interseccao de Listas -> Algoritmo 1(Prolog Mailing List)*/
>interseccao([], _, []).
>interseccao([A|As], Bs, ABs) :-
>	\+ member(A, Bs),
>	!,
>	interseccao(As, Bs, ABs).
>interseccao([A|As], Bs, [A|ABs]) :-
>	interseccao(As, Bs, ABs).
Herege doesn't suffer from insanity. He enjoys every minute of it.
                                       
                                   *****HEREGE*****


