8.2 The Label Type

Type Constructor

LabelType

Usage

import from Integer;
SingletonSpecies(L: LabelType): CombinatorialSpecies L == {
    CharacteristicSpecies(1)(L) add;
}    

Description

The type for Labels of a combinatorial species.

ToDo 13
rhx 8 25-Aug-2006: The label domain must provide infinitely many different elements since we might need infinitely many labels.

05-Sep-2006: Maybe it is a good idea to have a way to create new labels that have not been in use before. That would be relevant for defining the Derivative of a species.

62cat: LabelType 62  (55 569a)  572
define LabelType: Category == with {
        PrimitiveType;
        OutputType;
        exports: LabelType 64
}

Defines:
LabelType, used in chunks 54, 55, 65–67, 71, 79b, 83–85, 89, 96, 106, 117, 127, 131a, 136, 146, 166a, 175a, 182a, 191a, 194, 452, 458b, 461, 626, 643–50, 652, 654, 655, 658, 719, 721, 723, and 729.

Uses OutputType 570.

Exports of LabelType

elements: () -> Generator % Generates different elements of the type.

Export of LabelType

elements: () -> Generator %

Description

Generates different elements of the type.

ToDo 14
rhx 9 10-Oct-2006: The intention is to generate infinitely many elements. However, not every species can do this. So maybe we need different LabelType categories.
64exports: LabelType 64  (62)
elements: () -> Generator %;

Uses Generator 617.
65ext: String with LabelType 65  (55)
extend String: LabelType == add {
        local str(i: Integer): String == {
                s: StringBuffer := new();
                tw := s :: TextWriter;
                tw << i;
                string s;
        }
        elements(): Generator % == generate {
                import from Integer;
                for i in 1 .. repeat yield str i;
        }
}

Defines:
String, used in chunks 50, 53, 54, 83, 84, 87d, 88, 94, 104b, 114, 125b, 129b, 133c, 144a, 155a, 164, 175b, 182b, 198, 243, 245, 272, 299, 329, 332, 438, 441, 442, 446, 447, 455, 487, 504, 524, 578, 579, 583, 587c, 591, 616, 617, 621, 623, 644, 679b, 680b, 730–32, 739, and 740.

Uses Generator 617, Integer 66, and LabelType 62.
ToDo 15
rhx 10 07-Dec-2006: The line looking like

Rep == Integer; import from Rep;

is actually a trick to avoid the explicit appearance of

import from IntegerSegment %;

which would otherwise be necessary instead.

My suspicion is that this extra import actually is a bug in the compiler since in the add part of an extendable domain its exports should already be visible. Also just saying

import from Integer;

is rejected by the compiler. It simply ignores to import from Integer.
66ext: Integer with LabelType 66  (55)
extend Integer: LabelType == add {
        Rep == Integer; import from Rep;
        elements(): Generator % == generate {
                for i: Integer in 1 .. repeat yield i;
        }
}

Defines:
Integer, used in chunks 47, 54, 65, 83–85, 127, 137, 160, 232b, 234, 236, 273a, 279a, 280b, 282, 311–14, 316–19, 321b, 334, 336–39, 369–75, 379–83, 432, 438, 442, 455, 531–34, 578–86, 589, 595, 597c, 599, 601a, 603–5, 623, 628, 644, 648–50, 652, 654, 655, 657, 658, 661a, 670–75, 680–84, 686–95, 702–5, 717, 728, 729, 731, 732, and 740.

Uses Generator 617 and LabelType 62.
67ext: MachineInteger with LabelType 67  (55)
extend MachineInteger: LabelType == add {
        Rep == MachineInteger; import from Rep;
        elements(): Generator % == generate {
                for i: MachineInteger in 1 .. repeat yield i;
        }
}

Defines:
MachineInteger, used in chunks 47, 53, 54, 153, 157, 185b, 188b, 211, 212, 264a, 266a, 296, 297, 307, 313, 319, 329, 340, 379, 396, 401a, 410–12, 416, 455, 458b, 477, 486a, 492a, 510, 537, 538, 557–60, 562a, 564a, 566, 658, 729, and 744–46.

Uses Generator 617 and LabelType 62.