Global Information Lookup Global Information

Enumerated type information


In computer programming, an enumerated type (also called enumeration, enum, or factor in the R programming language, and a categorical variable in statistics) is a data type consisting of a set of named values called elements, members, enumeral, or enumerators of the type. The enumerator names are usually identifiers that behave as constants in the language. An enumerated type can be seen as a degenerate tagged union of unit type. A variable that has been declared as having an enumerated type can be assigned any of the enumerators as a value. In other words, an enumerated type has values that are different from each other, and that can be compared and assigned, but are not specified by the programmer as having any particular concrete representation in the computer's memory; compilers and interpreters can represent them arbitrarily.

For example, the four suits in a deck of playing cards may be four enumerators named Club, Diamond, Heart, and Spade, belonging to an enumerated type named suit. If a variable V is declared having suit as its data type, one can assign any of those four values to it.

Although the enumerators are usually distinct, some languages may allow the same enumerator to be listed twice in the type's declaration. The names of enumerators need not be semantically complete or compatible in any sense. For example, an enumerated type called color may be defined to consist of the enumerators Red, Green, Zebra, Missing, and Bacon. In some languages, the declaration of an enumerated type also intentionally defines an ordering of its members (High, Medium and Low priorities); in others, the enumerators are unordered (English, French, German and Spanish supported languages); in others still, an implicit ordering arises from the compiler concretely representing enumerators as integers.

Some enumerator types may be built into the language. The Boolean type, for example is often a pre-defined enumeration of the values False and True. A unit type consisting of a single value may also be defined to represent null. Many languages allow users to define new enumerated types.

Values and variables of an enumerated type are usually implemented with some integer type as the underlying representation. Some languages, especially system programming languages, allow the user to specify the bit combination to be used for each enumerator, which can be useful to efficiently represent sets of enumerators as fixed-length bit strings. In type theory, enumerated types are often regarded as tagged unions of unit types. Since such types are of the form , they may also be written as natural numbers.

and 22 Related for: Enumerated type information

Request time (Page generated in 0.8136 seconds.)

Enumerated type

Last Update:

type. A variable that has been declared as having an enumerated type can be assigned any of the enumerators as a value. In other words, an enumerated...

Word Count : 4403

Boolean data type

Last Update:

COBOL, FACT and JOVIAL. A built-in Boolean data type was then provided as a predefined enumerated type with values FALSE and TRUE. By definition, all comparisons...

Word Count : 2985

Data type

Last Update:

enumerators named CLUB, DIAMOND, HEART, SPADE, belonging to an enumerated type named suit. If a variable V is declared having suit as its data type,...

Word Count : 3433

C syntax

Last Update:

references to a specific enumerated type use the enum keyword and the name of the enum. By default, the first constant in an enumeration is assigned the value...

Word Count : 9787

Enumerator

Last Update:

the context of iteratees in computer programming, a value of an enumerated type Enumerator (computer science), a Turing machine that lists elements of some...

Word Count : 107

TypeScript

Last Update:

Type annotations and compile-time type checking Type inference Type erasure Interfaces Enumerated types Generics Namespaces Tuples Async/await Explicit...

Word Count : 3196

Enumerate

Last Update:

cultural heritage Enumerated type in computer programming This disambiguation page lists articles associated with the title Enumerate. If an internal link...

Word Count : 63

Enumeration

Last Update:

theory, the notion of enumeration has a broader sense, and does not require the set being enumerated to be finite. When an enumeration is used in an ordered...

Word Count : 1637

Chomsky hierarchy

Last Update:

to be generated can be generated by a Type-0 grammar. These languages are also known as the recursively enumerable or Turing-recognizable languages. Note...

Word Count : 1310

Comparison of Pascal and C

Last Update:

ord('1') = 49 and chr(9) is a TAB character. In Pascal, boolean is an enumerated type. The possible values of boolean are false and true, with ordinal value...

Word Count : 6293

Algebraic data type

Last Update:

of the sets of all possible values of its variants. Enumerated types are a special case of sum types in which the constructors take no arguments, as exactly...

Word Count : 2056

Haxe

Last Update:

identity<T>(arg:T):T { return arg; } Enumerated types are an important feature of the language; they can have type parameters and be recursive. They provide...

Word Count : 2358

Tagged union

Last Update:

has type τ {\displaystyle \tau } . The sum type corresponds to intuitionistic logical disjunction under the Curry–Howard correspondence. An enumerated type...

Word Count : 3265

List of data structures

Last Update:

unique identifier Enumerated type, a set of symbols Complex, representation of complex numbers Array, a sequence of elements of the same type stored contiguously...

Word Count : 911

Comparison of C Sharp and Java

Last Update:

implementing interfaces. Whereas in C#, an enumerated type is simply syntactic sugar around an integral type (typically an int) meaning they cannot be...

Word Count : 13903

Bracket

Last Update:

curly bracket languages. They are also used to define structures and enumerated type in these languages. In various Unix shells, they enclose a group of...

Word Count : 5768

Factor

Last Update:

also known as factoring, the organization of computer code Enumerated type: a data type consisting of a set of named values, called factor in the R programming...

Word Count : 509

Enum

Last Update:

protocols to unify the telephone system with the Internet An enumerated type, a data type consisting of a set of named values This disambiguation page...

Word Count : 74

Type safety

Last Update:

computer science, type safety and type soundness are the extent to which a programming language discourages or prevents type errors. Type safety is sometimes...

Word Count : 3647

Kardashev scale

Last Update:

representing the interactions between a civilization and its environment, and enumerated a number of scientific problems arising from these interactions with the...

Word Count : 16823

Multiton pattern

Last Update:

implemented using an enumerated type, with the values of the type corresponding to the instances. In the case of an enumerated type with a single value...

Word Count : 610

Lexical analysis

Last Update:

feeds tokens to the parser, the representation used is typically an enumerated type which is a list of number representations. For example, "Identifier"...

Word Count : 3323

PDF Search Engine © AllGlobal.net