summaryrefslogtreecommitdiff
path: root/test/fivesix.adb
blob: b8046af94fa00d406d0daf2649206360725cdde8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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 : Mu_World := Empty_Mu_World;
    Result : Mu_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;