call((append(As,Bs,[1,2,3,4]),writeq(user,append(As,Bs,[1,2,3,4])))).
结果:
append([],[1,2,3,4],[1,2,3,4])
As = [],
Bs = [1,2,3,4] ? ;
append([1],[2,3,4],[1,2,3,4])
As = [1],
Bs = [2,3,4] ? ;
append([1,2],[3,4],[1,2,3,4])
As = [1,2],
Bs = [3,4] ? ;
append([1,2,3],[4],[1,2,3,4])
As = [1,2,3],
Bs = [4] ? ;
append([1,2,3,4],[],[1,2,3,4])
As = [1,2,3,4],
Bs = [] ? ;
no
但如果我试试这个:
call((append(As,Bs,[1,2,3,4]) -> writeq(append(As,Bs,[1,2,3,4])) ; writeq('There are no solutions.\n'))).
它回馈了这个:
append([],[1,2,3,4],[1,2,3,4])
As = [],
Bs = [1,2,3,4] ? ;
no
有什么区别?我尝试写它,以便它可以判断是否有0个解决方案。