From ab78413a044900e421d2e0144f3c170bdc3f0b18 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Mon, 9 Feb 2026 11:54:31 +1300 Subject: More complete IDDFS that resets counter when backtracking --- test/complete.adb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/complete.adb') diff --git a/test/complete.adb b/test/complete.adb index 0890e8b..75aadf5 100644 --- a/test/complete.adb +++ b/test/complete.adb @@ -35,6 +35,14 @@ procedure Complete is return Disjunct (One, Two); end Fives; + function Simple + (This : in Goal; + Item : in Term'Class) + return Goal is + begin + return This.Unify (Item, 1); + end Simple; + begin TIO.Put_Line ("This program will loop forever unless the implementation is using"); @@ -65,6 +73,19 @@ begin TIO.New_Line; + declare + Relation : Goal := Empty_Goal; + Value : constant Term := Relation.Fresh; + begin + Relation.Unify (Value, 9); + Relation := Fives (Relation, Value); + Relation.Disjunct (Empty_Goal.Conjunct (Simple'Access, Value)); + TIO.Put_Line ("Value is " & Printer.Image (Value.Resolve (Relation.Run)) & + " after escaping Conjunct trap."); + end; + + TIO.New_Line; + TIO.Put_Line ("Test complete."); end Complete; -- cgit