%**********************************************************************
% Author:  Scotty Smith 
% Purpose: A Prolog tree pretty-printer
%**********************************************************************

%% Sample: pretty_print(['A', [['B', [['D'], ['E']], ['C']]], 0).
pretty_print([H, [L, R]], D) :-
	tab(2 * D), write(H), write('\n'),
	pretty_print(L, D + 1), pretty_print(R, D + 1).
pretty_print([Freq, Val], D) :-
	tab(2 * D), write(Freq), write(' '), write(Val), write('\n').
