findall/4 should be declared as a meta-predicate (#873)
This commit is contained in:
@@ -694,16 +694,18 @@ findall(Template, Goal, Solutions) :-
|
|||||||
'$get_lh_from_offset_diff'(LhOffset, Solutions0, Solutions1).
|
'$get_lh_from_offset_diff'(LhOffset, Solutions0, Solutions1).
|
||||||
|
|
||||||
|
|
||||||
% :- meta_predicate findall(?, 0, ?, ?).
|
:- meta_predicate findall(?, 0, ?, ?).
|
||||||
|
|
||||||
findall(Template, Goal, Solutions0, Solutions1) :-
|
findall(Template, Goal, Solutions0, Solutions1) :-
|
||||||
error:can_be(list, Solutions0),
|
error:can_be(list, Solutions0),
|
||||||
error:can_be(list, Solutions1),
|
error:can_be(list, Solutions1),
|
||||||
'$lh_length'(LhLength),
|
'$lh_length'(LhLength),
|
||||||
'$call_with_default_policy'(catch(builtins:'$iterate_find_all_diff'(Template, Goal, Solutions0,
|
'$call_with_default_policy'(
|
||||||
Solutions1, LhLength),
|
catch(builtins:'$iterate_find_all_diff'(Template, Goal, Solutions0,
|
||||||
Error,
|
Solutions1, LhLength),
|
||||||
( builtins:truncate_lh_to(LhLength), builtins:throw(Error) ))).
|
Error,
|
||||||
|
( builtins:truncate_lh_to(LhLength), builtins:throw(Error) ))
|
||||||
|
).
|
||||||
|
|
||||||
set_difference([X|Xs], [Y|Ys], Zs) :-
|
set_difference([X|Xs], [Y|Ys], Zs) :-
|
||||||
X == Y, !, set_difference(Xs, [Y|Ys], Zs).
|
X == Y, !, set_difference(Xs, [Y|Ys], Zs).
|
||||||
|
|||||||
Reference in New Issue
Block a user