I have executed the intersection of two arrays using intersection in prolog. How can I execute this manually without using 'intersection'?

```
intersection([],[],[]).
intersection(_,[], []).
intersection(List1, [Head2|Tail2], output):-
    \+(member(Head2, List1)), intersection(List1, Tail2, output).
intersection(List1, [Head2|Tail2], [Head2|output]):-
    member(Head2, List1), intersection(List1, Tail2, output).

```