Ordinal Data Type¶
An ordinal data type gives its language-defined values ordered integer positions that support stepping and contiguous subranges.
Core Idea¶
An ordinal data type has values whose language-defined order assigns integer positions, supporting position, predecessor/successor and contiguous-subrange operations. ISO Pascal calls integer, Boolean, character, enumeration and subrange types ordinal. Ada calls enumeration and integer types discrete and likewise assigns positions, but the two language categories should not be declared identical in every edge case.[ref-e9e75f1551a8][ref-daa77279c491]
Scope of Application¶
Pascal's standard defines ordinal types and ord, succ, pred; Ada's Reference Manual defines discrete types, their positions and range constraints. Language specification, not mathematical countability, decides admission. Ada's successor attribute also applies to some non-discrete scalar types, so a machine successor alone is not sufficient.[ref-e9e75f1551a8][ref-daa77279c491]
Clarity¶
Pascal's official (red, yellow, green, blue, tartan) enumeration assigns positions 0–4 in declaration order. Thus succ(yellow)=green, pred(red) has no valid result, and its printed red..green subrange comprises only the first three literals. Ada's official Day=(Mon,Tue,Wed,Thu,Fri,Sat,Sun) gives positions 0–6; Weekday is Day range Mon .. Fri excludes Sat and Sun while retaining them as Day values. Day'Succ(Thu)=Fri. These are calculations from the two standards' own examples, not reported compiler runs.[ref-e9e75f1551a8][ref-daa77279c491-2]
Manages Complexity¶
Semantic positions permit common operations over names that have no inherent numeric meaning. A subrange constrains a larger host type; an endpoint step may fail rather than wrap. This helps distinguish type rules from incidental storage encoding, but each language's own rules govern which uses are legal.[ref-e9e75f1551a8][ref-daa77279c491]
Abstract Reasoning¶
For an ordered type V with position map p, consecutive enumeration values satisfy p(vᵢ₊₁)=p(vᵢ)+1. A contiguous subrange [a,b] takes values with p(a)≤p(v)≤p(b). Reordering Pascal's color literals changes their positions and successors without changing their names. Expanding Ada's Weekday bound to Sun changes subtype membership without changing Day's underlying enumeration.[ref-e9e75f1551a8][ref-daa77279c491-2]
Knowledge Transfer¶
The useful cross-language diagnostic is to inspect which types a specification classifies as discrete, how it assigns positions, where stepping ends, and how range bounds work. Similar operation names elsewhere do not establish category identity. No universal intrinsic two-sided tension or direct prime parent is asserted; the live Data Type entry is the strict domain-specific parent.[ref-e9e75f1551a8][ref-daa77279c491]
[^ref-e9e75f1551a8]: ISO/IEC 7185:1990, Programming languages—Pascal, original standard, §§6.4.2.1–6.4.2.4 and §6.6.6.4. [^ref-daa77279c491]: Ada 2022 Reference Manual, §3.5 “Scalar Types”: discrete types, positions and scalar successor attributes. [^ref-daa77279c491-2]: Ada 2022 Reference Manual, §3.5.1 “Enumeration Types”: position rule and Day/Weekday declarations.
Relationships to Other Abstractions¶
Current abstraction Ordinal Data Type Domain-specific
Parents (1) — more general patterns this builds on
-
Ordinal Data Type is a kind of Data Type Domain-specific
An ordinal data type is a data type with language-defined integer positions, step operations and contiguous subranges.
Hierarchy path (1) — routes to 1 parentless root
- Ordinal Data Type → Data Type → Classification
Neighborhood in Abstraction Space¶
Ordinal Data Type sits in a sparse region of the domain-specific corpus (70th percentile for distinctiveness): few abstractions share its structure, so a faithful description tends to retrieve it precisely.
Family — Type Systems & Functional Constructs (18 abstractions)
Nearest neighbors
- List (computing) — 0.84
- Signedness — 0.84
- Self-Organizing List — 0.84
- Rope (Data Structure) — 0.83
- Propositional logic — 0.83
Computed from structural-signature embeddings · 2026-10-08