Re: Issue with creating a meta-interpreater

banky97 <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
As i have explained before, I am new to this programming language. This is an
example of trace which I am trying to see how i can improvise it to do
something.

johny_trace(Goal):- johny_trace(Goal,0).

johny_trace(true,Depth):-!. %red cut

johny_trace((Goal1,Goal2), Depth):-!, %red cut johny_trace(Goal1, Depth),
johny_trace(Goal2, Depth).

johny_trace(Goal,Depth):- display('Call:',Goal,Depth), clause(Goal,Body),
Depth1 is Depth+1, johny_trace(Body,Depth1), display('Exit:',Goal,Depth),
display_redo(Goal,Depth).

johny_trace(Goal,Depth):- display('Fail:', Goal, Depth), fail.

display(Message,Goal,Depth):- tab(Depth),write(Message), write(Goal),nl.

display_redo(Goal,Depth):- true; display('Redo:',Goal,Depth), fail.



--
View this message in context: http://swi-prolog.996271.n3.nabble.com/Issue-with-creating-a-meta-interpreater-tp14623p14658.html
Sent from the SWI Prolog mailing list archive at Nabble.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.