Printer Friendly
Dictionary, Encyclopedia and Thesaurus - The Free Dictionary
3,897,590,001 visitors served.
forum Join the Word of the Day Mailing List For webmasters
?
Dictionary/
thesaurus
Medical
dictionary
Legal
dictionary
Financial
dictionary
Acronyms
 
Idioms
Encyclopedia
Wikipedia
encyclopedia
?

algebraic data type
(redirected from Algebraic datatypes)

   Also found in: Wikipedia 0.01 sec.
(programming)algebraic data type - (Or "sum of products type") In functional programming, new types can be defined, each of which has one or more constructors. Such a type is known as an algebraic data type. E.g. in Haskell we can define a new type, "Tree":

data Tree = Empty | Leaf Int | Node Tree Tree

with 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, 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).


Want to thank TFD for its existence? Tell a friend about us, add a link to this page, add the site to iGoogle, or visit the webmaster's page for free fun content.
?Page tools
Printer friendly
Cite / link
Feedback
Mentioned in?   Encyclopedia browser?   Full browser?
No references found
 
 
Algebra of Logic
algebra of subsets
Algebra Readiness Diagnostic Testing
Algebra Research Group Oxford
algebra with identity
Algebra, Logic and Geometry in Informatics
algebraic
algebraic
algebraic addition
Algebraic and Combinatorial Coding Theory
Algebraic and Geometric Topology
Algebraic and Syntactic Methods in Computer Science
Algebraic biology
algebraic closure of a field
Algebraic Code-Excited Linear Prediction
Algebraic Combinatorics Environment
Algebraic Compiler
Algebraic Compiler and Translator
algebraic computation system
Algebraic correspondence
Algebraic correspondence
Algebraic correspondence
Algebraic correspondence
Algebraic curve
Algebraic curve
Algebraic curves
Algebraic curves
Algebraic data type
Algebraic data types
Algebraic datatype
Algebraic datatypes
Algebraic Decision Diagram
algebraic deviation
Algebraic Diagrammatic Construction
Algebraic dual
Algebraic element
Algebraic equation
Algebraic equations
Algebraic expression
Algebraic extension
Algebraic extension of a field
Algebraic Feedback Shift Register
Algebraic form
Algebraic form
Algebraic Forms
Algebraic Forms
Algebraic fraction
Algebraic fraction
Algebraic Frames for the Perception-Action Cycle
Algebraic function
Algebraic function
Algebraic functions
Algebraic functions
Algebraic Functions of Views
Algebraic General Topology
Algebraic geometry
Algebraic geometry
Algebraic Geometry and Geometric Modeling
Algebraic Geometry, Algebra, and Applications
Algebraic Geometry: A Total Hypertext Online System
Algebraic Hierarchical Equations for Application Design
 
Encyclopedia
?

Terms of Use | Privacy policy | Feedback | Advertise with Us | Copyright © 2012 Farlex, Inc.
Disclaimer
All content on this website, including dictionary, thesaurus, literature, geography, and other reference data is for informational purposes only. This information should not be considered complete, up to date, and is not intended to be used in place of a visit, consultation, or advice of a legal, medical, or any other professional.