I want to freeze my goal until some variable, for example list, is unbounded, right now I have
sieve(N,L) :-
freeze(Aux,sieve(N,L,[],Aux)),
numlist(2,N,Aux).
sieve(N,L,R,[H|T]) :-
freeze(X, X mod H =\= 0 ; X == H),
findall(X,select(X,T,_),P),
sieve(N,L,[H|R],P).
sieve(_,L,L,[]).
But it stop after some operations and waits forever. Could someone tell me how to correct this?
Ok i found out solution i had to change recursive call in
sieve
so now i call it in freeze predicate.as requested i found clue here Lazy lists in Prolog?