This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "Algebraic data type" – news · newspapers · books · scholar · JSTOR(October 2015) (Learn how and when to remove this message)
This article may be too technical for most readers to understand. Please help improve it to make it understandable to non-experts, without removing the technical details.(September 2017) (Learn how and when to remove this message)
(Learn how and when to remove this message)
In computer programming, especially functional programming and type theory, an algebraic data type (ADT) is a kind of composite type, i.e., a type formed by combining other types.
Two common classes of algebraic types are product types (i.e., tuples and records) and sum types (i.e., tagged or disjoint unions, coproduct types or variant types).[1]
The values of a product type typically contain several values, called fields. All values of that type have the same combination of field types. The set of all possible values of a product type is the set-theoretic product, i.e., the Cartesian product, of the sets of all possible values of its field types.
The values of a sum type are typically grouped into several classes, called variants. A value of a variant type is usually created with a quasi-functional entity called a constructor. Each variant has its own constructor, which takes a specified number of arguments with specified types. The set of all possible values of a sum type is the set-theoretic sum, i.e., the disjoint union, 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 one value is defined for each constructor.
Values of algebraic types are analyzed with pattern matching, which identifies a value by its constructor or field names and extracts the data it contains.
^Records and variants- OCaml manual section 1.4 Archived 2020-04-28 at the Wayback Machine
and 23 Related for: Algebraic data type information
type theory, an algebraicdatatype (ADT) is a kind of composite type, i.e., a type formed by combining other types. Two common classes of algebraic types...
programming, a generalized algebraicdatatype (GADT, also first-class phantom type, guarded recursive datatype, or equality-qualified type) is a generalization...
indicating its current type for enhanced type safety. An algebraicdatatype (ADT) is a possibly recursive sum type of product types. A value of an ADT consists...
Boolean algebra. It is named after George Boole, who first defined an algebraic system of logic in the mid 19th century. The Boolean datatype is primarily...
like algebraic number theory and algebraic topology. The word algebra itself has several meanings. Algebraic may also refer to: Algebraicdatatype, a datatype...
they can have type parameters and be recursive. They provide basic support for algebraicdatatypes, allowing the inclusion of product types, in a fashion...
types provided by most languages for algebraic computation, such as Mathematica and Maple. Many languages that do not have a built-in rational type still...
relational algebra and tuple relational calculus, SQL consists of many types of statements, which may be informally classed as sublanguages, commonly: Data query...
are part of a general class of types known as algebraicdatatypes. In the early 1980s, quotient types were defined and implemented as part of the Nuprl...
collection of data values, the relationships among them, and the functions or operations that can be applied to the data, i.e., it is an algebraic structure...
data = data; } } In algebraicdatatypes, a constructor is one of many tags that wrap data. If a constructor does not take any data arguments, it is nullary...
arguments, and more closely related to the constructor function of an algebraicdatatype system. The word "cons" and expressions like "to cons onto" are also...
programmer uses for algebraicdatatypes, data structures, or other components (e.g. "string", "array of float", "function returning boolean"). Type systems are...
Tutorial Lecture 3: Data Abstraction". "Algebraicdatatypes in Common Lisp". GitHub. Retrieved 11 May 2020. "Mutable Data Structures" (PDF). Retrieved 28 November...
forms. Most typed functional programming languages implement tuples directly as product types, tightly associated with algebraicdatatypes, pattern matching...
constructors of algebraicdatatypes. Here are some functions, each using pattern matching on each of the types below: -- This type signature says that...
from an initial algebra into some other algebra. Catamorphisms provide generalizations of folds of lists to arbitrary algebraicdatatypes, which can be...
write theorem-proving tactics, supporting algebraicdatatypes, parametric polymorphism, abstract datatypes, and exceptions. Theorems in the system are...