check if argument to when is bound (obs from Ulrich Neumerkel).

This commit is contained in:
Vitor Santos Costa 2009-05-17 10:58:21 -07:00
parent f4e3869025
commit 55036ad9bb

View File

@ -315,6 +315,8 @@ when(_,Goal) :-
% $when/5 and $when_suspend succeds when there is need to suspend a goal % $when/5 and $when_suspend succeds when there is need to suspend a goal
% %
% %
'$when'(V, G, Done, LG0, LGF) :- var(V), !,
'$do_error'(instantiation_error,when(V,G)).
'$when'(nonvar(V), G, Done, LG0, LGF) :- '$when'(nonvar(V), G, Done, LG0, LGF) :-
'$when_suspend'(nonvar(V), G, Done, LG0, LGF). '$when_suspend'(nonvar(V), G, Done, LG0, LGF).
'$when'(?=(X,Y), G, Done, LG0, LGF) :- '$when'(?=(X,Y), G, Done, LG0, LGF) :-