Write a program in Prolog to implement vanish(R,L,N) where R denotes the element whose all occurrences has to be remove from list L to obtain list N.
This should work :
vanish(_,[],[]). vanish(E,[E|Ls],N) :- vanish(E,Ls,N). vanish(E,[L|Ls],[L|Ns]) :- L\=E, vanish(E,Ls,Ns).