From 01047ba9fce09324c50795339dd2aa1a9344409a Mon Sep 17 00:00:00 2001 From: Evan Hubinger Date: Sun, 20 Oct 2024 01:36:06 -0700 Subject: [PATCH] Fix docs Resolves #854. --- DOCS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DOCS.md b/DOCS.md index a3d7441a..7ccb3169 100644 --- a/DOCS.md +++ b/DOCS.md @@ -1324,7 +1324,7 @@ point(1,2) |> (==)$(point(1,2)) |> print _Showcases matching to data types and the default equality operator. Values defined by the user with the `data` statement can be matched against and their contents accessed by specifically referencing arguments to the data type's constructor._ ```coconut -class Tree +data Tree data Empty() from Tree data Leaf(n) from Tree data Node(l, r) from Tree @@ -1338,7 +1338,7 @@ Empty() |> depth |> print Leaf(5) |> depth |> print Node(Leaf(2), Node(Empty(), Leaf(3))) |> depth |> print ``` -_Showcases how the combination of data types and match statements can be used to powerful effect to replicate the usage of algebraic data types in other functional programming languages._ +_Showcases how the combination of data types and match statements can be used to powerful effect to replicate the usage of algebraic data types in other functional programming languages. Note that for `Tree` to be used for each case rather than `Empty`/`Leaf`/`Node`, `Tree` needs to be a `data` type to ensure that [`data` matching rather than `class` matching](#semantics-specification) is performed._ ```coconut def duplicate_first([x] + xs as l) =