Algebraic data types

0Citations
Citations of this article
2Readers
Mendeley users who have this article in their library.
Get full text

Abstract

Algebraic data types are a concise representation of types permitted in some functional languages as StandardML and Haskell. They can also be defined in Scala, and although their definition is more cumbersome, they are useful. Formally, an algebraic data type defines a new type as a composition of other types or a set of possible constants. In the definition of the type, we can enumerate the set of alternatives, some of them can be recursive. For example, we can define a type for the four suits in playing cards (spades, hearts, diamonds, clubs), the days of the week, the values in Boolean or in Kleene’s trivalued logic. We can also consider the product of these types. For example, to form a deck we have e.g. 13 cards per suit (Ace, King, Queen, Jack, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10), and two jokers. An advantage of algebraic definitions is that they permit to define functions by means of pattern matchin.

Cite

CITATION STYLE

APA

Torra, V. (2016). Algebraic data types. In Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics) (Vol. 9980 LNCS, pp. 87–92). Springer Verlag. https://doi.org/10.1007/978-3-319-46481-7_7

Register to see more suggestions

Mendeley helps you to discover research relevant for your work.

Already have an account?

Save time finding and organizing research with Mendeley

Sign up for free