diff options
| author | Jedidiah Barber <contact@jedbarber.id.au> | 2025-11-10 18:57:08 +1300 |
|---|---|---|
| committer | Jedidiah Barber <contact@jedbarber.id.au> | 2025-11-10 18:57:08 +1300 |
| commit | 7719622ff4f72769f15a771dc5455dabeff295bc (patch) | |
| tree | c7800c67504178b6ef8591735ddaa72f3a2c9d41 /src/kompsos-pretty_print.adb | |
| parent | dbe103313c66e0a510ce689ba72b1d2d0857a457 (diff) | |
Infinite number of States in a World enabled with lazy evaluation
Diffstat (limited to 'src/kompsos-pretty_print.adb')
| -rw-r--r-- | src/kompsos-pretty_print.adb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/kompsos-pretty_print.adb b/src/kompsos-pretty_print.adb index d1d89b8..62f27fa 100644 --- a/src/kompsos-pretty_print.adb +++ b/src/kompsos-pretty_print.adb @@ -124,14 +124,18 @@ package body Kompsos.Pretty_Print is (Item : in World) return String is - Result : SU.Unbounded_String; + Result : SU.Unbounded_String; + Scratch : World := Item; + Counter : Positive := 1; begin - if Item.Possibles.Is_Empty then + if not Scratch.Has_State (Counter) then return "States: N/A" & Latin.LF; end if; - for Index in Integer range Item.Possibles.First_Index .. Item.Possibles.Last_Index loop - SU.Append (Result, "State#" & Image (Index) & ":" & Latin.LF); - SU.Append (Result, Image (Item.Possibles.Constant_Reference (Index))); + loop + SU.Append (Result, "State#" & Image (Counter) & ":" & Latin.LF); + SU.Append (Result, Image (Scratch.Possibles.Constant_Reference (Counter))); + Counter := Counter + 1; + exit when not Scratch.Has_State (Counter); end loop; return SU.Slice (Result, 1, SU.Length (Result) - 1); end Image; |
