Navigation
Synopsis A definition of a data type.
Description An Abstract Data Type is a mathematical description of a structure that can be implemented in various ways. For instance, a stack data type can be characterized by empty (the empty stack), two functions push and pop and axioms that define them. At the implementation level, a stack can be implemented using a list, array or something else.

In functional languages, and also in Rascal, abstract datatypes (or ADTs for short) are used to define new data types. Well-known examples are stack and tree.

See Rascal:AlgebraicDataType and Rascal:Values/Constructor.
Examples

Abstract Data Types in daily life

  • A stack of trays in the local cafetaria.
  • A tree.
  • Coral.
dispenser credit tree credit coralcredit

Abstract Data Types in computer science

  • The run-time stack of a programming language interpreter.
  • A search tree.
  • An ontology.

Abstract Data Types in Rascal

  • A tree data type:
    data MyTree = leaf(int n) | tree(str name, MyTree left, MyTree right);
    
Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.