chore: Demo & examples

This commit is contained in:
Tibo De Peuter 2025-05-18 23:27:35 +02:00
parent 61178cbeac
commit b294467587
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
9 changed files with 228 additions and 23 deletions

View file

@ -0,0 +1,27 @@
interpreter :-
interpreter_prompt,
read(Goal),
interpreter(Goal).
interpreter_prompt :- write('Next Command ?-- ').
interpreter(exit) :- !.
interpreter(Goal) :-
ground(Goal), !,
solve_ground(Goal),
interpreter.
interpreter(Goal) :-
solve(Goal),
interpreter.
solve_ground(Goal) :-
call(Goal),
!,
writeln('True :)').
solve_ground(_) :- writeln('False :(').
solve(Goal) :-
call(Goal),
writeln(Goal),
fail.
solve(_) :- writeln('No more solutions :/').