7

OCaml で C スタイルの前方宣言を行う方法はありますか?

私の問題は、相互に参照する 2 つのバリアントがあることです。

type path_formula =
  [ `Next of state_formula
  | `Until of (state_formula * state_formula)
  | `UntilB of (state_formula * int * state_formula)  
  ]

type state_formula = 
    [ `True | `False
    | `Not of state_formula
    | `And of (state_formula * state_formula)
    | `Or of (state_formula * state_formula)
    | `Imply of (state_formula * state_formula)
    | `Label of string
    | `Prob` of (boundf * path_formula)
    | `Expc` of (boundi * formula)
    ]

したがって、両方のタイプがもう一方のタイプを知っている必要があります..Googleで検索しましたが、残念ながらOCamlはそれほど広く使用されているプログラミング言語ではありません..

4

1 に答える 1

16

使用する

type T1 = ...
and T2 = ...

再帰型を持つ。

于 2010-06-11T20:56:46.027 に答える