diff options
| author | Jedidiah Barber <contact@jedbarber.id.au> | 2025-11-09 13:23:16 +1300 |
|---|---|---|
| committer | Jedidiah Barber <contact@jedbarber.id.au> | 2025-11-09 13:23:16 +1300 |
| commit | dbe103313c66e0a510ce689ba72b1d2d0857a457 (patch) | |
| tree | 81292450c11d27d6c6293527284f5919382c4cc7 /test | |
Initial commit
Diffstat (limited to 'test')
| -rw-r--r-- | test/ab.adb | 44 | ||||
| -rw-r--r-- | test/pprint.adb | 55 |
2 files changed, 99 insertions, 0 deletions
diff --git a/test/ab.adb b/test/ab.adb new file mode 100644 index 0000000..a371f2f --- /dev/null +++ b/test/ab.adb @@ -0,0 +1,44 @@ + + +-- 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 AB is + + package TIO renames Ada.Text_IO; + + + package SKomp is new Kompsos (Integer); + use SKomp; + + package SPrin is new SKomp.Pretty_Print (Integer'Image); + use SPrin; + + Verse : World := Empty_World; + Ref : Variable; + +begin + + TIO.Put_Line ("Test program to output a-and-b example from 2013 microKanren paper."); + + TIO.New_Line; + + Ref := Verse.Fresh ("a"); + Verse.Unify (Ref, 7); + Ref := Verse.Fresh ("b"); + Verse := Disjunct (Verse.Unify (Ref, 5), Verse.Unify (Ref, 6)); + + TIO.Put_Line (Image (Verse)); + +end AB; + + diff --git a/test/pprint.adb b/test/pprint.adb new file mode 100644 index 0000000..6d05cba --- /dev/null +++ b/test/pprint.adb @@ -0,0 +1,55 @@ + + +-- Programmed by Jedidiah Barber +-- Licensed under the Sunset License v1.0 + +-- See license.txt for further details + + +with + + Ada.Strings.Unbounded, + Ada.Text_IO, + Kompsos.Pretty_Print; + + +procedure PPrint is + + package SU renames Ada.Strings.Unbounded; + package TIO renames Ada.Text_IO; + + function "+" + (Item : in String) + return SU.Unbounded_String + renames SU.To_Unbounded_String; + + + package SKomp is new Kompsos (SU.Unbounded_String); + use SKomp; + + package SPrin is new SKomp.Pretty_Print (SU.To_String); + use SPrin; + + Term_One : constant Term := T (+"Hello"); + Term_Two : constant Term := T (T (+"One") & T (+"Two") & T (+"Three")); + Term_Three : constant Term := T (Term_One & Term_Two & T (+"World")); + Term_Four : constant Term := T (Null_Term & Null_Term); + +begin + + TIO.Put_Line ("Test program to output String representation of some Terms and an empty World."); + + TIO.New_Line; + + TIO.Put_Line (Image (Term_One)); + TIO.Put_Line (Image (Term_Two)); + TIO.Put_Line (Image (Term_Three)); + TIO.Put_Line (Image (Term_Four)); + + TIO.New_Line; + + TIO.Put_Line (Image (Empty_World)); + +end PPrint; + + |
