> :- trace('append/3').
> :- trace(['append/3', 'reverse/2', '=/2']).
This is a example after specify append/3 to TRACE.
> append([],X,X).
> append([A|X], Y, [A|Z]) :- append(X,Y,Z).
> ?- append(X,Y,[a]).
TRACE: ENTER append/3(1) - enter the first clause of append.
bot, bot, < a > - arity is (bot, bot, [a]) .
TRACE: SUCCESS append/3(1) - success the first clause of append.
< >, < a >, < a > - arity become ([], [a], [a]).
X: < > - output of result.
Y: < a >
Enter ';' for more choices, otherwise press ENTER --> ;
TRACE: REENTER append/3(2) - backtrack and reenter the second clause of append.
bot, bot, < a > - arity is (bot, bot, [a]) .
TRACE: ENTER append/3(1) --- enter the first clause of append.
list, bot, < > --- arity is (list, bot, []) .
TRACE: SUCCESS append/3(1) --- success the first clause of append.
< >, < >, < > --- arity is ([], [], []).
TRACE: SUCCESS append/3(2) - success the cause of call,append.
< a >, < >, < a > - arity is ([a], [], [a]).
X: < a > - output of result.
Y: < >
Enter ';' for more choices, otherwise press ENTER --> ;
TRACE: REENTER append/3(2) --- backtrack append that called in front.
list, bot, < > --- arity is (list, bot, []).
TRACE: FAIL append/3 --- fail that append.
list, bot, < > --- arity is (list, bot, []) .
TRACE: FAIL append/3 - fail the cause of call, append
bot, bot, < a > - arity is (bot, bot, [a]).
no - return no.
|