Różnice
Różnice między wybraną wersją a wersją aktualną.
|
|
pl:prolog:pllib:meta_interpreter_7 [2019/06/27 15:50] |
pl:prolog:pllib:meta_interpreter_7 [2019/06/27 15:50] (aktualna) |
| ====== Meta interpreter 7 ====== |
| {{tag>metainterpreter}} |
| ===== Description ===== |
| A meta-interpreter for pure Prolog in continuation style |
| |
| **Source**: The Art of Prolog |
| ===== Download ===== |
| Program source code: {{meta_interpreter_7.pl}} |
| ===== Listing ===== |
| <code prolog> |
| /* |
| solve(Goal) :- |
| Goal is true given the pure Prolog program defined by clause/2. |
| */ |
| |
| solve(Goal) :- solve(Goal,[]). |
| |
| solve([],[]). |
| solve([],[G|Goals]) :- solve(G,Goals). |
| solve([A|B],Goals) :- append(B,Goals,Goals1),solve(A,Goals1). |
| solve(A,Goals) :- rule(A,B), solve(B,Goals). |
| |
| % Program 17.6 A meta-interpreter for pure Prolog in continuation style |
| </code> |
| ===== Comments ===== |
| |