OnlineWoerterBuecher.de
Internes

Lexikon


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). (1994-11-23)

In addition suitable contents:
[ 2 ] [ = ] [ abstract data type ] [ AD ] [ ad ] [ ADT ] [ af ] [ ag ] [ ai ] [ al ] [ algebra ] [ algebraic ] [ am ] [ an ] [ app ] [ application ] [ ar ] [ arc ] [ arg ] [ argument ] [ as ] [ at ] [ b ] [ be ] [ bi ] [ bj ] [ br ] [ bs ] [ by ] [ C ] [ ca ] [ case ] [ cat ] [ ch ] [ ci ] [ co ] [ com ] [ con ] [ cons ] [ constructed type ] [ constructor ] [ cr ] [ D ] [ data ] [ data type ] [ de ] [ ding ] [ disc ] [ discriminated union ] [ du ] [ E ] [ ec ] [ ed ] [ edu ] [ ee ] [ element ] [ enumeration ] [ er ] [ era ] [ es ] [ et ] [ fi ] [ file ] [ fix ] [ fo ] [ for ] [ fr ] [ Fun ] [ function ] [ functional ] [ functional program ] [ functional programming ] [ function application ] [ ge ] [ gh ] [ gr ] [ gu ] [ h ] [ hat ] [ hing ] [ hose ] [ hr ] [ id ] [ ie ] [ il ] [ in ] [ inc ] [ io ] [ is ] [ it ] [ ke ] [ ki ] [ kn ] [ la ] [ Lex ] [ li ] [ list ] [ lr ] [ ls ] [ lu ] [ ly ] [ ma ] [ man ] [ mm ] [ mo ] [ mod ] [ module ] [ mp ] [ mu ] [ N ] [ na ] [ nc ] [ ne ] [ nf ] [ ng ] [ ni ] [ nl ] [ nn ] [ no ] [ norm ] [ normal form ] [ ns ] [ nu ] [ O ] [ object ] [ om ] [ op ] [ pa ] [ pattern matching ] [ pe ] [ ph ] [ pl ] [ port ] [ pr ] [ product ] [ program ] [ programming ] [ pt ] [ query ] [ rc ] [ re ] [ ro ] [ ru ] [ S ] [ sa ] [ sam ] [ sc ] [ se ] [ set ] [ set theory ] [ si ] [ sk ] [ so ] [ Spec ] [ spec ] [ st ] [ struct ] [ su ] [ sum ] [ sum of products type ] [ sy ] [ syntax ] [ T ] [ ] [ tag ] [ tc ] [ th ] [ theory ] [ to ] [ tr ] [ tt ] [ type ] [ ua ] [ ug ] [ um ] [ union ] [ us ] [ va ]






Go Back ]

Free On-line Dictionary of Computing

Copyright © by OnlineWoerterBuecher.de - (10603 Reads)

All logos and trademarks in this site are property of their respective owner.

Page Generation in 0.2031 Seconds, with 17 Database-Queries
Zurück zur Startseite