更改

删除57字节 、 2020年12月12日 (六) 13:20
第135行: 第135行:  
An inductively defined recursive data definition is one that specifies how to construct instances of the data.  For example, linked lists can be defined inductively (here, using Haskell syntax):
 
An inductively defined recursive data definition is one that specifies how to construct instances of the data.  For example, linked lists can be defined inductively (here, using Haskell syntax):
   −
归纳定义是指定如何构造数据实例的定义。例如,字符串列表可以被归纳定义为(在这里,使用Haskell语法):
+
归纳定义是指定如何构造数据实例的定义。例如,字符串列表可以被归纳定义为(这里使用Haskell语法):
    
<syntaxhighlight lang="haskell">data ListOfStrings = EmptyList | Cons String ListOfStrings</syntaxhighlight>
 
<syntaxhighlight lang="haskell">data ListOfStrings = EmptyList | Cons String ListOfStrings</syntaxhighlight>
第152行: 第152行:     
归纳定义的另一个例子是'''<font color="#ff8000">自然数 natural numbers</font>'''(或正整数):
 
归纳定义的另一个例子是'''<font color="#ff8000">自然数 natural numbers</font>'''(或正整数):
−
  −
      
<pre>A natural number is either 1 or n+1, where n is a natural number.</pre>
 
<pre>A natural number is either 1 or n+1, where n is a natural number.</pre>
第177行: 第175行:  
This says that an expression is either a number, a product of two expressions, or a sum of two expressions.  By recursively referring to expressions in the second and third lines, the grammar permits arbitrarily complex arithmetic expressions such as <code>(5 * ((3 * 6) + 8))</code>, with more than one product or sum operation in a single expression.
 
This says that an expression is either a number, a product of two expressions, or a sum of two expressions.  By recursively referring to expressions in the second and third lines, the grammar permits arbitrarily complex arithmetic expressions such as <code>(5 * ((3 * 6) + 8))</code>, with more than one product or sum operation in a single expression.
   −
这意味着一个表达式要么是一个数字,要么是两个表达式的乘积,要么是两个表达式的和。通过在第二行和第三行中递归引用表达式,该语法允许任意复杂的算术表达式,如 < code > (5 * ((3 * 6) + 8)) </code > ,在一个表达式中有多个乘积或和运算。
+
这意味着一个表达式要么是一个数字,要么是两个表达式的乘积,要么是两个表达式的和。通过在第二行和第三行中递归引用表达式,该语法允许任意复杂的算术表达式,如 <code> (5 * ((3 * 6) + 8)) </code> ,在一个表达式中有多个乘积或和运算。
 +
 
    +
===协归纳定义的数据和共递归===
   −
===Coinductively defined data and corecursion===
  −
协同定义的数据和共递归
   
{{main|Coinduction|Corecursion}}
 
{{main|Coinduction|Corecursion}}
 
A coinductive data definition is one that specifies the operations that may be performed on a piece of data; typically, self-referential coinductive definitions are used for data structures of infinite size.
 
A coinductive data definition is one that specifies the operations that may be performed on a piece of data; typically, self-referential coinductive definitions are used for data structures of infinite size.
第187行: 第185行:  
A coinductive data definition is one that specifies the operations that may be performed on a piece of data; typically, self-referential coinductive definitions are used for data structures of infinite size.
 
A coinductive data definition is one that specifies the operations that may be performed on a piece of data; typically, self-referential coinductive definitions are used for data structures of infinite size.
   −
协同归纳数据定义是一种规定了可以对一段数据进行操作的定义;; 通常,自引用的协同归纳定义用于无限大小的数据结构。
+
协归纳数据定义是一种规定了可以对一段数据进行操作的定义;;通常,自引用的协归纳定义用于无限大小的数据结构。
    
A coinductive definition of infinite [[stream (computer science)|streams]] of strings, given informally, might look like this:
 
A coinductive definition of infinite [[stream (computer science)|streams]] of strings, given informally, might look like this:
385

个编辑