Subject: [SWIPL] Prolog help

From: Nuno Baptista <[email-masked]>
Date: Mon, 18 Dec 2000 15:45:26 GMT

I've already found a way to intersect lists. If anyone wants to use here it is.
lista([],S,[]). 
lista(S,[],[]):-
	S\=[]. 
lista([X|TX],[X|TY],[X|TZ]):- 
	lista(TX,TY,TZ). 
lista([X|TX],[Y|TY],TZ):- 
	lista(TX,[Y|TY],TZ). 
lista([X|TX],[Y|TY],TZ):- 
	lista([X|TX],TY,TZ). 

But i need help on something else:
I'm trying to find a way to get the the names of the places where a bus goes to, here it is the code i have write 
now. I could use a litle help. Thanks.

ligacao has a origin and a list of destinies : like (ligacao('Pr. Liberdade',['Serra Pilar','S. Domingos','Carmo','Av. 
Aliados']).)

autocarro has the numbers of the bus that has a stop in some place : 
	autocarro('Pr.Liberdade',[1,7,91,33,83,15,19,76,54]).

the rest of the code is here, but it's not working properly:

percurso(Destino,Destino,[]).
percurso(Origem,Destino,Lista):-
	autocarro(Origem,LA1),
	ligacao(Origem,LO),
	member(NO,LO),
	autocarro(NO,LA2),
	lista(LA1,LA2,L),
	percurso(NO,Destino,L).

Herege doesn't suffer from insanity. He enjoys every minute of it.
                                       
                                   *****HEREGE*****