I have the following structure of "facts".
if( conds, score, idx).
Then I expect to have thousands of them. The 'conds' is a conditions that will be evaluated as the facts are processed. For every fact that is true I store the score and the index in a list for further processing.
The general idea is to findall/3
facts and then go over them ...
findall([Cond, Q, Ix], clause(if(Cond, Q, Ix), true), Conds)
check(Conds, True_QIxLst) ...
My worry is that findall/3
would gobble all thousand of facts for every run i.e. use too much memory.
How would I do what findall
does, but process the conditions one-by-one.
I will still process all the conditions, but I would like to use less memory.
As per "mat" suggestion this seem to work out :
is_true(Q,Ix) :-
if(Cond, Q, Ix),
check(Cond).
run(QI) :-
findall([Q,Ix], is_true(Q,Ix), QI).