Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

pl:prolog:pllib:interactive_shell [2019/06/27 15:50]
pl:prolog:pllib:interactive_shell [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Interactive shell ======
 +{{tag>​expert_shell interactive}}
 +===== Description =====
 +An interactive shell
 +
 +**Source**: ​ The Art of Prolog
 +===== Download =====
 +Program source code: {{interactive_shell.pl}}
 +===== Listing =====
 +<code prolog>
 +     shell :-  shell_prompt,​ read(Goal), shell(Goal).
 +
 +     ​shell(exit) :- !.
 +     ​shell(Goal) :-
 +        ground(Goal),​ !, shell_solve_ground(Goal),​ shell. ​
 +     ​shell(Goal) :- 
 +        shell_solve(Goal),​ shell.
 +
 +     ​shell_solve(Goal) :-
 + Goal, write(Goal),​ nl, fail.
 +     ​shell_solve(Goal) :- 
 +        write('​No (more) solutions'​),​ nl.
 +     
 +     ​shell_solve_ground(Goal) :- 
 + Goal, !, write('​Yes'​),​ nl.
 +     ​shell_solve_ground(Goal) :- 
 + write('​No'​),​ nl.
 +          ​
 +     ​shell_prompt :-  write('​Next command? ').
 +
 +% Program 12.6    An interactive shell
 +</​code>​
 +===== Comments =====
  
pl/prolog/pllib/interactive_shell.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0