findall/4 should be declared as a meta-predicate (#873)

This commit is contained in:
Mark Thom
2021-03-17 18:13:06 -06:00
parent 5c2059b4e8
commit b98e8c34eb

View File

@@ -694,16 +694,18 @@ findall(Template, Goal, Solutions) :-
'$get_lh_from_offset_diff'(LhOffset, Solutions0, Solutions1).
% :- meta_predicate findall(?, 0, ?, ?).
:- meta_predicate findall(?, 0, ?, ?).
findall(Template, Goal, Solutions0, Solutions1) :-
error:can_be(list, Solutions0),
error:can_be(list, Solutions1),
'$lh_length'(LhLength),
'$call_with_default_policy'(catch(builtins:'$iterate_find_all_diff'(Template, Goal, Solutions0,
Solutions1, LhLength),
Error,
( builtins:truncate_lh_to(LhLength), builtins:throw(Error) ))).
'$call_with_default_policy'(
catch(builtins:'$iterate_find_all_diff'(Template, Goal, Solutions0,
Solutions1, LhLength),
Error,
( builtins:truncate_lh_to(LhLength), builtins:throw(Error) ))
).
set_difference([X|Xs], [Y|Ys], Zs) :-
X == Y, !, set_difference(Xs, [Y|Ys], Zs).