有人可以向我解释这是什么吗?
(\+ setof((P1,C),P^R^Bag,PS) -> ...
otherwise ->...
我已经阅读了setof的文档;我的理解是,最主要的论点与事实相统一。
但是,我无法理解上面的代码段。
完整的代码段是:
solve_task_bt(go(Target),Agenda,ClosedSet,F,G,NewPos,RR,BackPath) :-
Agenda = [Current|Rest],
Current = [c(F,G,P)|RPath],
NewAgenda = Rest,
Bag = search(P,P1,R,C),
(\+ setof((P1,C),P^R^Bag,PS) -> solve_task_bt(go(Target),Rest,[Current|ClosedSet],F,G,NewPos,RR,BackPath);
otherwise ->
setof((P1,C),P^R^Bag,PS),
addChildren(PS,RPath,Current,NewAgenda,Target,Result),
NewClosedSet = [Current|ClosedSet],
NewestAgenda = Result,
solve_task_bt(go(Target),NewestAgenda,NewClosedSet,F1,G1,Pos,P|RPath,BackPath)
). % backtrack search
所以,只关注setof/3