“使用seq时找不到实例”>

问题描述 投票:0回答:1

我为合金使用No instance found报告该模型的seq感到困惑:

one sig Const {
  T: seq (seq Int)
}

fact const_facts {
  Const.T = {
    0 -> {0->1 + 1->9} +
    1 -> {0->3 + 1->15}
  }
}

run {} for 20 but 6 Int, 8 seq

虽然下面的模型,其中我仅用seq替换了每个Int ->,但有一个实例,正如人们所期望的那样:

one sig Const {
  T: Int -> (Int -> Int)
}

fact const_facts {
  Const.T = {
    0 -> {0->1 + 1->9} +
    1 -> {0->3 + 1->15}
  }
}

run {} for 20 but 6 Int

[这让我特别困惑,因为https://alloytools.org/quickguide/seq.html似乎暗示seq XInt -> X在类型方面是同一件事。

有什么想法吗?

[我对合金报告使用seq找不到该模型的实例感到困惑:一个sig Const {T:seq(seq Int)} fact const_facts {Const.T = {0-> {0-> 1 + 1-> 9} +1-&...

alloy
1个回答
0
投票

您创建的Const.T具有3的稀有度,而seq必须是2的稀有度。

© www.soinside.com 2019 - 2024. All rights reserved.