diff options
| author | Jedidiah Barber <contact@jedbarber.id.au> | 2025-11-12 20:34:24 +1300 |
|---|---|---|
| committer | Jedidiah Barber <contact@jedbarber.id.au> | 2025-11-12 20:34:24 +1300 |
| commit | c9e156fdc3449d1cbc9dac4176cc460f6462ef18 (patch) | |
| tree | eff51bebfc12e4417a6d70c49d696d703bd43745 /src/kompsos.ads | |
| parent | 9ae0a7e7c5d7669a81fe9eba13ff9c6224635efe (diff) | |
Prelude now derives its own World so dot notation works for those subprograms
Diffstat (limited to 'src/kompsos.ads')
| -rw-r--r-- | src/kompsos.ads | 120 |
1 files changed, 46 insertions, 74 deletions
diff --git a/src/kompsos.ads b/src/kompsos.ads index bed3d26..a8b8851 100644 --- a/src/kompsos.ads +++ b/src/kompsos.ads @@ -22,10 +22,6 @@ generic package Kompsos is - type Variable is private; - type Variable_Array is array (Positive range <>) of Variable; - - type Term is tagged private; type Term_Array is array (Positive range <>) of Term; @@ -42,11 +38,7 @@ package Kompsos is return Term; function T - (Item : in Variable) - return Term; - - function T - (Item1, Item2 : in Term) + (Item1, Item2 : in Term'Class) return Term; function T @@ -56,122 +48,102 @@ package Kompsos is -- Might include subprograms to retrieve Term contents later? - type World is tagged private; - type World_Array is array (Positive range <>) of World; + type Mu_World is tagged private; + type Mu_World_Array is array (Positive range <>) of Mu_World; - Empty_World : constant World; - - function Failed - (This : in out World) - return Boolean; + Empty_Mu_World : constant Mu_World; function Fresh - (This : in out World) - return Variable; + (This : in out Mu_World'Class) + return Term; function Fresh - (This : in out World; + (This : in out Mu_World'Class; Name : in String) - return Variable; + return Term; function Fresh - (This : in out World; + (This : in out Mu_World'Class; Name : in Ada.Strings.Unbounded.Unbounded_String) - return Variable; + return Term; function Unify - (This : in World; - Left : in Variable; + (This : in Mu_World; + Left : in Term'Class; Right : in Element_Type) - return World; + return Mu_World; procedure Unify - (This : in out World; - Left : in Variable; + (This : in out Mu_World; + Left : in Term'Class; Right : in Element_Type); function Unify - (This : in World; - Left, Right : in Variable) - return World; - - procedure Unify - (This : in out World; - Left, Right : in Variable); - - function Unify - (This : in World; - Left : in Variable; - Right : in Term'Class) - return World; - - procedure Unify - (This : in out World; - Left : in Variable; - Right : in Term'Class); - - function Unify - (This : in World; + (This : in Mu_World; Left, Right : in Term'Class) - return World; + return Mu_World; procedure Unify - (This : in out World; + (This : in out Mu_World; Left, Right : in Term'Class); function Disjunct - (Left, Right : in World) - return World; + (Left, Right : in Mu_World) + return Mu_World; procedure Disjunct - (This : in out World; - Right : in World); + (This : in out Mu_World; + Right : in Mu_World); function Disjunct - (Inputs : in World_Array) - return World; + (Inputs : in Mu_World_Array) + return Mu_World; procedure Disjunct - (This : in out World; - Inputs : in World_Array); + (This : in out Mu_World; + Inputs : in Mu_World_Array); function Recurse - (This : in World) - return World; + (This : in Mu_World) + return Mu_World; procedure Recurse - (This : in out World); + (This : in out Mu_World); function Take - (This : in World; + (This : in Mu_World; Count : in Natural) - return World; + return Mu_World; procedure Take - (This : in out World; + (This : in out Mu_World; Count : in Natural); procedure Force - (This : in out World; + (This : in out Mu_World; Count : in Positive); procedure Force_All - (This : in out World); + (This : in out Mu_World); + + function Failed + (This : in out Mu_World) + return Boolean; private @@ -259,7 +231,7 @@ private - type World_Access is access World; + type World_Access is access Mu_World'Class; type Generator_Kind is (No_Gen, @@ -300,33 +272,33 @@ private (Index_Type => Positive, Element_Type => State); - type World is new Ada.Finalization.Controlled with record + type Mu_World is new Ada.Finalization.Controlled with record Possibles : State_Vectors.Vector; Next_Ident : ID_Number; Engine : Generator; end record; overriding procedure Adjust - (This : in out World); + (This : in out Mu_World); overriding procedure Finalize - (This : in out World); + (This : in out Mu_World); function Has_State - (This : in out World; + (This : in out Mu_World; Index : in Positive) return Boolean; procedure Rollover - (This : in out World); + (This : in out Mu_World); procedure Roll_Until - (This : in out World; + (This : in out Mu_World; Index : in Positive); use type State_Vectors.Vector; - Empty_World : constant World := (Ada.Finalization.Controlled with + Empty_Mu_World : constant Mu_World := (Ada.Finalization.Controlled with Possibles => State_Vectors.Empty_Vector & Empty_State, Next_Ident => 0, Engine => (Kind => No_Gen)); |
