slovo | definícia |
data type (foldoc) | type
data type
(Or "data type") A set of values from
which a variable, constant, function, or other
expression may take its value. A type is a classification
of data that tells the compiler or interpreter how the
programmer intends to use it. For example, the process and
result of adding two variables differs greatly according to
whether they are integers, floating point numbers, or strings.
Types supported by most programming languages include
integers (usually limited to some range so they will fit in
one word of storage), Booleans, floating point numbers,
and characters. Strings are also common, and are
represented as lists of characters in some languages.
If s and t are types, then so is s -> t, the type of
functions from s to t; that is, give them a term of type s,
functions of type s -> t will return a term of type t.
Some types are primitive - built-in to the language, with no
visible internal structure - e.g. Boolean; others are
composite - constructed from one or more other types (of
either kind) - e.g. lists, arrays, structures, unions.
Object-oriented programming extends this with classes
which encapsulate both the structure of a type and the
operations that can be performed on it.
Some languages provide strong typing, others allow {implicit
type conversion} and/or explicit type conversion.
(2003-12-22)
|
| podobné slovo | definícia |
abstract data type (foldoc) | abstract data type
ADT
(ADT) A kind of data abstraction where a
type's internal form is hidden behind a set of {access
functions}. Values of the type are created and inspected only
by calls to the access functions. This allows the
implementation of the type to be changed without requiring any
changes outside the module in which it is defined.
Objects and ADTs are both forms of data abstraction, but
objects are not ADTs. Objects use procedural abstraction
(methods), not type abstraction.
A classic example of an ADT is a stack data type for which
functions might be provided to create an empty stack, to
push values onto a stack and to pop values from a stack.
{Reynolds paper
(http://cis.upenn.edu/~gunter/publications/documents/taoop94.html)}.
{Cook paper "OOP vs ADTs"
(http://wcook.org/papers/OOPvsADT/CookOOPvsADT90.pdf)}.
(2003-07-03)
|
algebraic data type (foldoc) | algebraic data type
sum of products 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)
|
library of efficient data types and algorithms (foldoc) | Library of Efficient Data types and Algorithms
LEDA
(LEDA) A class library for C++ of efficient data
types (e.g. graph classes) and algorithms by Stefan
N"aher of the {University of
Saarbruecken}. Version 3.0 includes both template and
non-template versions.
(ftp://ftp.mpi-sb.mpg.de/pub/LEDA).
(1996-04-15)
|
|