To make programs easier to read, you should always indent the goals of
rules.
If you typed in your procedure for intersection as follows, it
would look like a series of facts:
If you indent the goals, it is much clearer what is a fact and what is a rule:% intersection/3 intersection([],_,[]):- !. intersection([H|T],L,[H|T2]):- member(H,L),!, intersection(T,L,T2). intersection([_H|T],L,T2):- intersection(T,L,T2).
% intersection/3
intersection([],_,[]):- !.
intersection([H|T],L,[H|T2]):-
member(H,L),!,
intersection(T,L,T2).
intersection([_H|T],L,T2):-
intersection(T,L,T2).
You can indent goals by using the tab key. Emacs recognises
files that end in .pl and will automatically move the cursor to
a suitable place for the goal.
<a.von.klopp@bangor.ac.uk>