什么是相互递归的类型?

ome*_*ega 1 types ml sml recursive-datastructures mutual-recursion

如果在ML中,递归数据类型的示例是:

datatype llist = Nil | Node of int * llist
Run Code Online (Sandbox Code Playgroud)

什么是相互递归的数据类型,在ML中是什么样的?

Jes*_*erg 5

一个这样的例子可能是这些愚蠢的数据类型.

datatype a = A | Ab of b
and      b = B | Ba of a
Run Code Online (Sandbox Code Playgroud)

它们毫无意义,但是它们表明可以使用and关键字(就像函数一样)来引用"前方"的东西,这通常是不可能的

它们是相互的(因为它们都......)递归(...相互引用)