Help on insert using delete



Hi all,

this delete/3 implementations deletes all occurences of an Element
within a list.

delete(_,[],[]).
delete(X,[X|L],M):-!,delete(X,L,M).
delete(X,[Y|L1],[Y|L2]):-delete(X,L1,L2).

Is it possible to use it, to insert an Element?

with another implementation of delete/3 - which only deletes the
Elements once i got it allready working.

% loesche(X,L1,L2),
delete(X, [X|T], T).
delete(X, [H|T1], [H|T2]) :- delete(X, T1, T2).

insert(X,L1,L2) :- delete(X,L2,L1).

.