Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tiene_alergia(pepe, amoxicilina).
- tiene_alergia(pepe, ampicilina).
- contiene(clamoxil, amoxicilina).
- contiene(britapen, ampicilina).
- posicion(Elemento,List, Posicion):- nth0(Posicion,List,Elemento).
- insertar(X, 0, L2, [X|L2]).
- insertar(X, Pos, [C|R], [C|R2]) :- Pos1 is Pos -1, insertar(X, Pos1, R, R2).
- borrar(I, L, L2) :- insertar(_,I,L2,L).
- eliminar(_,[],[]).
- eliminar(X, L1, L2) :- posicion(X, L1,Pos), borrar(Pos, L1, L2).
- eliminar([X|Xs], L1, L2):- eliminar(X, L1, L3), eliminar(Xs, L3, L2).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement