% pretty print a prolog structure pp(P):-pp([],P). pp(L,P):-atomic(P),indented_print(L,P). pp(L,P):-var(P),indented_print(L,P). pp(L,[H|T]):-indented_print(L,'['), pp([' |'|L],H),ppa([' |'|L],T),indented_print(L,']'). pp(L,P):-P=..[F|Arg], pp(L,F), ppa([' |'|L], Arg). ppa(L,[H|T]):-pp(L,H),ppa(L,T). ppa(L,[]):-true. indented_print([H|T], P):-write(H), indented_print(T, P). indented_print([],P):-write('-'), write(P), nl.