From c17bd6d4c177e3033be22d825cc261d8c50844e2 Mon Sep 17 00:00:00 2001 From: zhongl Date: Sun, 29 Oct 2023 16:05:23 +0800 Subject: [PATCH 1/3] Fix typo. --- src/pages/adt/structural-recursion.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/adt/structural-recursion.md b/src/pages/adt/structural-recursion.md index e11e34e3..565bd987 100644 --- a/src/pages/adt/structural-recursion.md +++ b/src/pages/adt/structural-recursion.md @@ -248,7 +248,7 @@ CssLength.Em(2.0) match { ``` Exhaustivity checking is incredibly useful. -For example, if we add or remove a case from an algebraic data type, the cmopiler will us all the pattern matches that need to be updated. +For example, if we add or remove a case from an algebraic data type, the compiler will us all the pattern matches that need to be updated. ### Dynamic Dispatch From e821bad5efc7c5cb05e5be4c24a619ea832bca54 Mon Sep 17 00:00:00 2001 From: zhongl Date: Mon, 30 Oct 2023 11:29:40 +0800 Subject: [PATCH 2/3] Reverse sum and product. --- src/pages/adt/conclusions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/adt/conclusions.md b/src/pages/adt/conclusions.md index 500ee062..84816076 100644 --- a/src/pages/adt/conclusions.md +++ b/src/pages/adt/conclusions.md @@ -2,7 +2,7 @@ We have covered a lot of material in this chapter. Let's recap the key points. -Algebraic data types allow us to express data types by combining existing data types with logical and and logical or. A logical and constructs a sum type while a logical or constructs a product type. Algebraic data types are the main way to represent data in Scala. +Algebraic data types allow us to express data types by combining existing data types with logical and and logical or. A logical and constructs a product type while a logical or constructs a sum type. Algebraic data types are the main way to represent data in Scala. Structural recursion gives us a skeleton for transforming any given algebraic data type into any other type. Structural recursion can be abstracted into a `fold` method. From f02ae10de5bc09b1ed98d56f7de01f0186166ed2 Mon Sep 17 00:00:00 2001 From: zhongl Date: Mon, 30 Oct 2023 11:33:04 +0800 Subject: [PATCH 3/3] Clean bracket. --- src/pages/adt/conclusions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/adt/conclusions.md b/src/pages/adt/conclusions.md index 84816076..18ada774 100644 --- a/src/pages/adt/conclusions.md +++ b/src/pages/adt/conclusions.md @@ -31,7 +31,7 @@ and relatively recent work is caked in layers of mathematics and obtuse notation The infamous [Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire][banana] is an example of such work. I suspect the core ideas of both date back to at least the emergence of computability theory in the 1930s, well before any digital computers existed. -The earliest reference I've found to structural recursion is [Proving Properties of Programs by Structural Induction][structural-induction]), which dates to 1969. +The earliest reference I've found to structural recursion is [Proving Properties of Programs by Structural Induction][structural-induction], which dates to 1969. Algebraic data types don't seem to have been fully developed, along with pattern matching, until [NPL][npl] in 1977. NPL was quickly followed by the more influential language [Hope][hope], which spread the concept to other programming languages.