Subject: FW:Re: [SWIPL] Prolog help

From: Nuno Baptista <[email-masked]>
Date: Tue, 19 Dec 2000 15:16:51 GMT

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*****