【问题标题】:How to force stop SWI-prolog during query on MacOS如何在 MacOS 上查询期间强制停止 SWI-prolog
【发布时间】:2018-10-05 18:02:05
【问题描述】:

有没有办法在查询期间强制停止 SWI-Prolog?例如,假设我有一个进入无限循环的谓词 (bad_foo(X))。当我在 SWI-Prolog 中查询此谓词时,查询会运行一段时间(有时几分钟),然后以 ERROR: Out of local stack 失败:

?- bad_foo(1).
(% and after a long wait...)
ERROR: Out of local stack

我的问题:如何在查询用完堆栈之前跳过等待并停止查询?简而言之,我正在寻找 Linux 中的 Ctrl + C 等价物。

我在 MacOS 上使用 SWI-Prolog 版本 7.6.4。

【问题讨论】:

    标签: swi-prolog


    【解决方案1】:

    虽然 Ctrl + C 不起作用,但按 Cmd + C 会暂停查询并提示帮助消息,然后可以通过键入 a 来中止查询:

    ?- bad_foo(1).
    (% press Cmd+C and you'll be prompted:)
    Action (h for help) ?
    (% press a to abort)
    abort
    ?- 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-02
      • 2012-09-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多