我想用
catch(:Goal, +Catcher, :Recover)
Run Code Online (Sandbox Code Playgroud)
目标在哪里
call_with_time_limit(+Time, :Goal)
Run Code Online (Sandbox Code Playgroud)
它搞砸了,我无法找到正确的方法来了解上述情况之一发生时间:
1)由于超时,目标停止了.
2)目标失败(有时候会失败).
我试过了:
(catch(call_with_time_limit(Time, Goal), Catcher, Recover) ->
(ground(Catcher), Catcher = time_limit_exceeded), **TIMEOUT ACTIONS**)
;
(**SUCCESS ACTIONS**))
;
**FAILURE ACTIONS**
)
Run Code Online (Sandbox Code Playgroud)
*编辑*
图案:
我使用以下模式:
((catch(call_with_time_limit(6,goal),
Exception,
true),(var(Exception);Exception=time_limit_exceeded))
->
(var(Exception) -> writeln(succ) ; writeln(timeout))
;
writeln(fail)
).
Run Code Online (Sandbox Code Playgroud)
该模式在4秒或更长时间内不起作用 - 它只是忽略了超时请求.