全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Product type, sum type, algebraic data type?

又称: product type · sum type · algebraic data type

Definition 7.1 University Computer Science — Year 2 · 第 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.

在原文中阅读 →