I have a question about this program in PROLOG that they left me, it is about that by means of a predicate like: show. show me all the content of the knowledge base that is flight, but the truth is that I have not found much about how to do it more than you could use the dynamic function that comes with default prolog, but it does not work for me.
mostrar:- dynamic(vuelo/3).
vuelo(nueva_york, chicago,1000).
vuelo(chicago, denver,1000).
vuelo(nueva_york, toronto,800).
vuelo(nueva_york, denver,1900).
% 1.- Hacer una regla donde visualice todos los viajes.
% 2.- Hacer una regla que elimine todos los viajes de un origen.
vuelade:-write('desde '),read(A),
write('a: '), read(B), encontrar(A,B).
encontrar(A,B):- ruta(A,B,D), write('La distancia es de '),write(D), write(' Km.'),!, nl.
ruta(A,B,C):- es_vuelo(A,B,C).
ruta(_,_,D):- !,write('no, hay ruta para ese destino '), nl, D=0, fail, !.
es_vuelo(T,T2,D):- vuelo(T,T2,D), write(T).
agregar:-write('desde: '),read(Desde),write('hacia: '),read(H),
write('distancia: '),read(Dis),
assert(vuelo(Desde,H,Dis)).
borrar :- write('Desde: '),read(Desde), retract(vuelo(Desde,_,_)), !,
write('vuelo Borrado').
borrar :- write('No existe este vuelo').
borratodo:- abolish(vuelo/3), write('vuelos Borrados').
Finally, this is my program, I hope you can guide me on how to do it.