define PrimitiveType: Category == with { =: (%, %) -> Boolean; ~=: (%, %) -> Boolean; } define AdditiveType: Category == with { 0: %; +: (%, %) -> %; -: % -> %; -: (%, %) -> %; add!: (%, %) -> %; minus!: % -> %; minus!: (%, %) -> %; zero?: % -> Boolean; } define ArithmeticType: Category == with { 1: %; *: (%, %) -> %; ^: (%, MachineInteger) -> %; commutative?: Boolean; one?: % -> Boolean; times!: (%, %) -> %; }The categories AdditiveType and ArithmeticType look like the definition of an abelian monoid and a ring. But in fact they only assert the existence of arithmetic operations without asserting algebraic properties such as commutativity, associativity, etc. This is needed for these sets of numbers (machine integers, floats) that do not have algebraic properties. If we look at the definition of MachineInteger in the interprter mode of ALDOR we get
%2 >> MachineInteger () @ Join( PrimitiveType with 0: % 1: % bytes: MachineInteger coerce: SInt -> % coerce: % -> SInt integer: Literal -> % min: % max: % odd?: % -> Boolean zero?: % -> Boolean == add () , Join(CopyableType, IntegerType) with mod+: (%, %, %) -> % mod-: (%, %, %) -> % mod*: (%, %, %) -> % mod/: (%, %, %) -> % mod^: (%, %, %) -> % modInverse: (%, %) -> % export to IntegerSegment(%) == add ()Figures 1 and 2 show the hierarchies of types in libaldor. On these pictures, domains are surrounded by dashed lines and domains by plain lines.