how to avoid increasing the stack for facts matching that fails
Posted: 29 Dec 2017 7:11
hello, I have the following clause:
according to recent instructions by VP colleagues I added the cut (!) after non-deterministic facts
matching commands to avoid increasing the stack.
However, I have now a situation that the following call:
fails and because of the succeeding cut, predicate
add_local_conditionally
fails as well, and so on and my top-level procedure fails and so my program.
This is a situation that I didn't have before in my project.
How can I deal with this, still maintaining the small stack feature?
thank you and Happy Holidays,
Michael
Code: Select all
add_local_conditionally(Module_name, In_local_list, In_local_entry, Out_list, Last_entry) :-
local_object(local_OBJECT(Module_name, In_local_entry, _, Object_name, _, _, _, _, _)),
Next_local_entry = In_local_entry + 1,
hierarchy_PART(1, Top_package_module, 0, _, _, _, _),
!,
local_object(local_OBJECT(Top_package_module, _, _, Object_name, _, _, _, _, _)),
!,
% it exists also in the package
Top_package_module <> Module_name,
% and the current module is not the Top package
Next_local_list = In_local_list,
% in this case the list is not updated with this local
get_and_append_local(Module_name, Next_local_list, Next_local_entry, Out_list, Last_entry).
matching commands to avoid increasing the stack.
However, I have now a situation that the following call:
Code: Select all
local_object(local_OBJECT(Top_package_module, _, _, Object_name, _, _, _, _, _)),
add_local_conditionally
fails as well, and so on and my top-level procedure fails and so my program.
This is a situation that I didn't have before in my project.
How can I deal with this, still maintaining the small stack feature?
thank you and Happy Holidays,
Michael