【问题标题】:Controling the Order of Procedures in Netlogo控制 Netlogo 中的程序顺序
【发布时间】:2015-02-19 18:16:20
【问题描述】:

min-one-of 报告了一个我不明白的错误。我了解min-one-of 需要报告程序。我有这个,下面标注为reporter-procedure

但是,我的报告程序将另一个程序的输出作为其输入。我的意图是other-procedure 的输出将作为输入输入reporter-procedure

Netlogo 告诉我,下面代码部分中的另一个程序other-procedure 应该是一个记者。为什么?

请注意,other-procedure 接受四个变量作为输入。

let best-taxi min-one-of available-taxis [reporter-procedure ( other-procedure var1 var2 var3 var4) ]

现在如果我不带括号尝试这个,错误消息是 reporter-procedure 预期 1 输入:

let best-taxi min-one-of available-taxis [reporter-procedure other-procedure var1 var2 var3 var4]

所以我猜reporter-procedure 先执行。如果是这样,为什么第一组代码(带括号的代码)不能让other-procedure先执行?

【问题讨论】:

    标签: procedure netlogo


    【解决方案1】:

    该错误实际上与min-one-of 没有任何关系。

    我的意图是将other-procedure 的输出作为其输入输入reporter-procedure

    只有记者有输出。要使other-procedure 具有输入到reporter-procedure 的输出,other-procedure 必须是报告者。

    您可能只需要使用to-report 而不是to 声明other-procedure,并确保在其末尾有一个report 和输出。

    【讨论】:

      猜你喜欢
      • 2021-09-14
      • 2012-04-23
      • 1970-01-01
      • 1970-01-01
      • 2013-03-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多