From 2ec591d4b2b4dc11356b7bc5f261050b2c49fed9 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Wed, 17 Dec 2025 09:44:49 +1300 Subject: Fivesix now tests manual recursion using Conjunct as well as the Recurse subprogram --- test/fivesix.adb | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/test/fivesix.adb b/test/fivesix.adb index a17cbb1..5876c44 100644 --- a/test/fivesix.adb +++ b/test/fivesix.adb @@ -23,7 +23,21 @@ procedure FiveSix is package InPrin is new InKomp.Pretty_Print (Integer'Image); use InPrin; - Fives, Sixes : World := Empty_World; + + -- It is possible to create a recursion using functions like this... + function Fives + (This : in World) + return World + is + One, Two : World := This; + begin + One.Unify (One.Fresh, 5); + Two.Conjunct (Fives'Access); + return Disjunct (One, Two); + end Fives; + + + Sixes : World := Empty_World; Result : World; begin @@ -33,14 +47,13 @@ begin TIO.New_Line; - Fives.Unify (Fives.Fresh, 5); - Fives.Recurse; - + -- ...but it is a lot simpler and easier to create recursions this way instead. Sixes.Unify (Sixes.Fresh, 6); Sixes.Recurse; - Result := Disjunct (Fives, Sixes); + Result := Disjunct (Fives (Empty_World), Sixes); + -- Note how the States from Fives keep creating new Variables instead of looping. TIO.Put_Line (Image (Result.Take (5))); end FiveSix; -- cgit