Algebraic data type

/ˌældʒəˈbreɪɪk ˈdeɪtə taɪp/ noun

Definition

A composite data type formed by combining other types using two operations: sum (union/variant) and product (tuple/record). Common examples include enums, optional types, and recursive structures like trees.

Etymology

The term comes from abstract algebra, where 'algebraic' refers to structures defined by operations and laws. Introduced in programming language theory in the 1970s, it draws parallels between type construction and algebraic operations - sum types represent 'OR' relationships, product types represent 'AND' relationships.

Kelly Says

Algebraic data types are like LEGO building blocks with mathematical precision - you can combine basic pieces (Int, String) using 'AND' (product) to make records, or 'OR' (sum) to make variants! This is why Rust's Result<T,E> can be either Ok(value) OR Err(error), never both - it's literally algebra applied to data modeling.

Related Words

Explore More Words

Get the Word Orb API

Complete word intelligence in one call. Free tier — 50 lookups/day.