Copyright © Philip M. Parker, INSEAD. Terms of Use.

| Domain | Definition |
Computing | Algebraic data type |
Source: compiled by the editor from various references; see credits. | |
(From Wikipedia, the free Encyclopedia)
data Tree = Empty | Leaf Int | Node Tree Treewith constructors "Empty", "Leaf" and "Node". The constructors can be used much like functions in that they can be (partially) applied to arguments of the appropriate type. For example, the Leaf constructor has the functional type Int -> Tree.
A constructor application cannot be reduced (evaluated) like a function application though since it is already in normal form. Functions which operate on algebraic data types can be defined using pattern matching:
depth :: Tree -> Int depth Empty = 0 depth (Leaf n) = 1 depth (Node l r) = 1 + max (depth l) (depth r)The most common algebraic data type is the list which has constructors Nil and Cons (Cons is the operator ++ or : defined to join two lists togheter), written in Haskell using the special syntax "[]" for Nil and infix ":" for Cons.
Special cases of algebraic types are product types (only one constructor) and enumeration types (many constructors with no arguments). Algebraic types are one kind of constructed type (i.e. a type formed by combining other types).
An algebraic data type may also be an abstract data type (ADT) if it is exported from a module without its constructors. Objects of such a type can only be manipulated using functions defined in the same module as the type itself.
In set theory the equivalent of an algebraic data type is a discriminated union - a set whose elements consist of a tag (equivalent to a constructor) and an object of a type corresponding to the tag (equivalent to the constructor arguments).
This article was originally based on material from FOLDOC, used with permission. Update as needed.
Source: adapted by the editor from Wikipedia, the free encyclopedia under a copyleft GNU Free Documentation License (GFDL) from the article "Algebraic data types."
Crosswords: ALGEBRAIC DATA TYPE |
| Specialty definitions using "ALGEBRAIC DATA TYPE": constructed type ♦ discriminated union ♦ sum of products type. (references) |
Hexadecimal (or equivalents, 770AD-1900s) (references)41 4C 47 45 42 52 41 49 43      44 41 54 41      54 59 50 45 |
| Leonardo da Vinci (1452-1519; backwards) (references)
|
Binary Code (1918-1938, probably earlier) (references)01000001 01001100 01000111 01000101 01000010 01010010 01000001 01001001 01000011 00100000 01000100 01000001 01010100 01000001 00100000 01010100 01011001 01010000 01000101 |
HTML Code (1990) (references)A L G E B R A I C   D A T A   T Y P E |
ISO 10646 (1991-1993) (references)0041 004C 0047 0045 0042 0052 0041 0049 0043      0044 0041 0054 0041      0054 0059 0050 0045 |
Encryption (beginner's substitution cypher): (references)354641393652354337238355435254595039 |
| 1. Crosswords 2. Orthography 3. Bibliography |
Copyright © Philip M. Parker, INSEAD. Terms of Use.