From d39d7f30fa897a0c12c6be8b5d2c6a122336f267 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Thu, 8 Jan 2026 13:36:46 +1300 Subject: Cleaned up code in Houses example --- example/houses.adb | 63 +++++++++++++++++++++++++++--------------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/example/houses.adb b/example/houses.adb index e5a63eb..945e416 100644 --- a/example/houses.adb +++ b/example/houses.adb @@ -26,8 +26,7 @@ with Ada.Text_IO, - Kompsos.Math, - Kompsos.Pretty_Print; + Kompsos.Math; procedure Houses is @@ -45,7 +44,7 @@ procedure Houses is -- Since the following subprograms are procedures, they cannot be used -- with Conjunct. Some don't take a Term_Array for inputs either. - -- But that's alright because we aren't conjuncting things here anyway. + -- But that's alright because we aren't Conjuncting things here anyway. procedure Unique (This : in out Goal; @@ -94,47 +93,47 @@ procedure Houses is Relation : Goal := Empty_Goal; - Allison : constant Term := Relation.Fresh; - Adrienne : constant Term := Relation.Fresh; - Belinda : constant Term := Relation.Fresh; - Benito : constant Term := Relation.Fresh; - Cheri : constant Term := Relation.Fresh; - Mr_Crawford : constant Term := Relation.Fresh; - Daryl : constant Term := Relation.Fresh; - Don : constant Term := Relation.Fresh; + Allison : constant Term := Relation.Fresh; + Adrienne : constant Term := Relation.Fresh; + Belinda : constant Term := Relation.Fresh; + Benito : constant Term := Relation.Fresh; + Cheri : constant Term := Relation.Fresh; + Crawford : constant Term := Relation.Fresh; + Daryl : constant Term := Relation.Fresh; + Don : constant Term := Relation.Fresh; Result : State; begin - Within_Range (Relation, Allison, Three, Eight); - Within_Range (Relation, Adrienne, One, Eight); - Within_Range (Relation, Belinda, Six, Eight); - Within_Range (Relation, Benito, One, Eight); - Within_Range (Relation, Cheri, Two, Eight); - Within_Range (Relation, Mr_Crawford, One, Eight); - Within_Range (Relation, Daryl, One, Three); - Within_Range (Relation, Don, One, Eight); + Within_Range (Relation, Allison, Three, Eight); + Within_Range (Relation, Adrienne, Two, Eight); + Within_Range (Relation, Belinda, Six, Eight); + Within_Range (Relation, Benito, Four, Seven); + Within_Range (Relation, Cheri, Five, Eight); + Within_Range (Relation, Crawford, Two, Eight); + Within_Range (Relation, Daryl, One, Three); + Within_Range (Relation, Don, Five, Seven); - Unique (Relation, Allison & Adrienne & Belinda & Benito & Cheri & Mr_Crawford & Daryl & Don); + Unique (Relation, Allison & Adrienne & Belinda & Benito & Cheri & Crawford & Daryl & Don); - Doors_From (Relation, Allison, One, Adrienne); - Doors_From (Relation, Belinda, Two, Benito); - Doors_From (Relation, Cheri, Three, Mr_Crawford); - Doors_From (Relation, Daryl, Four, Don); + Doors_From (Relation, Allison, One, Adrienne); + Doors_From (Relation, Belinda, Two, Benito); + Doors_From (Relation, Cheri, Three, Crawford); + Doors_From (Relation, Daryl, Four, Don); Math.GT (Relation, Cheri & Benito); Result := Relation.Run; - TIO.Put_Line ("Allison:" & Integer'Image (Math.Value (Allison.Resolve (Result)))); - TIO.Put_Line ("Adrienne:" & Integer'Image (Math.Value (Adrienne.Resolve (Result)))); - TIO.Put_Line ("Belinda:" & Integer'Image (Math.Value (Belinda.Resolve (Result)))); - TIO.Put_Line ("Benito:" & Integer'Image (Math.Value (Benito.Resolve (Result)))); - TIO.Put_Line ("Cheri:" & Integer'Image (Math.Value (Cheri.Resolve (Result)))); - TIO.Put_Line ("Mr Crawford:" & Integer'Image (Math.Value (Mr_Crawford.Resolve (Result)))); - TIO.Put_Line ("Daryl:" & Integer'Image (Math.Value (Daryl.Resolve (Result)))); - TIO.Put_Line ("Don:" & Integer'Image (Math.Value (Don.Resolve (Result)))); + TIO.Put_Line ("Allison:" & Integer'Image (Math.Value (Allison.Resolve (Result)))); + TIO.Put_Line ("Adrienne:" & Integer'Image (Math.Value (Adrienne.Resolve (Result)))); + TIO.Put_Line ("Belinda:" & Integer'Image (Math.Value (Belinda.Resolve (Result)))); + TIO.Put_Line ("Benito:" & Integer'Image (Math.Value (Benito.Resolve (Result)))); + TIO.Put_Line ("Cheri:" & Integer'Image (Math.Value (Cheri.Resolve (Result)))); + TIO.Put_Line ("Crawford:" & Integer'Image (Math.Value (Crawford.Resolve (Result)))); + TIO.Put_Line ("Daryl:" & Integer'Image (Math.Value (Daryl.Resolve (Result)))); + TIO.Put_Line ("Don:" & Integer'Image (Math.Value (Don.Resolve (Result)))); end Houses; -- cgit