Todos os livros

Profissional

Apps Sobre Coach Entrar Começar a ler

Computer Science · Glossário

O que é Product type, sum type, algebraic data type?

Também chamado de: product type · sum type · algebraic data type

Definition 7.1 University Computer Science — Year 2 · Capítulo 7 — Enums, Pattern Matching and Error Handling

A product type holds one value of each of its component types at once: a tuple (A, B) or a struct. A sum type holds one value of exactly one of its component types, together with which one: a Rust enum. The types built from basic types by products and sums, possibly recursively, are the algebraic data types.

Ler no capítulo →