From 2c3e688c3f779f0abfaad887f13ab2b70c9f814a Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Wed, 30 Jun 2021 01:58:24 +0000 Subject: Add backtracking to the evaluator. This means we have to keep track of choicepoints which is implemented the easy but wasteful way for now. I have also added a number which is used to differentiate variables from different application of the clauses. --- example.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'example.pl') diff --git a/example.pl b/example.pl index bf30ba6..64f08ab 100644 --- a/example.pl +++ b/example.pl @@ -25,4 +25,10 @@ curly(A) :- A = {one,two,three}. =(A,A). -:- initialization(could_be_friends(bob, sam)). \ No newline at end of file +length([], zero). +length([Head|Tail], suc(Length)) :- + length(Tail, Length). + +:- initialization(could_be_friends(bob, sam)). + +:- initialization(length([a,b,c,d], Len)). -- cgit v1.2.3