summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2025-11-10 18:57:08 +1300
committerJedidiah Barber <contact@jedbarber.id.au>2025-11-10 18:57:08 +1300
commit7719622ff4f72769f15a771dc5455dabeff295bc (patch)
treec7800c67504178b6ef8591735ddaa72f3a2c9d41 /test
parentdbe103313c66e0a510ce689ba72b1d2d0857a457 (diff)
Infinite number of States in a World enabled with lazy evaluation
Diffstat (limited to 'test')
-rw-r--r--test/ab.adb8
-rw-r--r--test/fivesix.adb48
2 files changed, 52 insertions, 4 deletions
diff --git a/test/ab.adb b/test/ab.adb
index a371f2f..80b11c3 100644
--- a/test/ab.adb
+++ b/test/ab.adb
@@ -17,11 +17,11 @@ procedure AB is
package TIO renames Ada.Text_IO;
- package SKomp is new Kompsos (Integer);
- use SKomp;
+ package InKomp is new Kompsos (Integer);
+ use InKomp;
- package SPrin is new SKomp.Pretty_Print (Integer'Image);
- use SPrin;
+ package InPrin is new InKomp.Pretty_Print (Integer'Image);
+ use InPrin;
Verse : World := Empty_World;
Ref : Variable;
diff --git a/test/fivesix.adb b/test/fivesix.adb
new file mode 100644
index 0000000..3eabf6a
--- /dev/null
+++ b/test/fivesix.adb
@@ -0,0 +1,48 @@
+
+
+-- Programmed by Jedidiah Barber
+-- Licensed under the Sunset License v1.0
+
+-- See license.txt for further details
+
+
+with
+
+ Ada.Text_IO,
+ Kompsos.Pretty_Print;
+
+
+procedure FiveSix is
+
+ package TIO renames Ada.Text_IO;
+
+
+ package InKomp is new Kompsos (Integer);
+ use InKomp;
+
+ package InPrin is new InKomp.Pretty_Print (Integer'Image);
+ use InPrin;
+
+ Fives, Sixes : World := Empty_World;
+ Result : World;
+
+begin
+
+ TIO.Put_Line ("Test program for fives-and-sixes example from 2013 microKanren paper.");
+ TIO.Put_Line ("Since the result is infinite, only the first five states will be shown.");
+
+ TIO.New_Line;
+
+ Fives.Unify (Fives.Fresh, 5);
+ Fives.Recurse;
+
+ Sixes.Unify (Sixes.Fresh, 6);
+ Sixes.Recurse;
+
+ Result := Disjunct (Fives, Sixes).Take (5);
+
+ TIO.Put_Line (Image (Result));
+
+end FiveSix;
+
+