Minerva supports so called term vectors to store and retrieve terms.
There exist different types of predicate classes to support the management of
global data: the Minerva database (manipulated with assert, retract,
clause, etc), global variables (manipulated with set_global, get_global, etc),
blackboards (manipulated with bb_put, bb_get, etc) and term vectors.
There exist the following predicates to handle term vectors:
A term vector is a kind of dynamically resizable array of terms.
Before you can store/retrieve terms from a term vector, you have to create
a term vector. This is done with tv_create/1. The term vector
is initially empty, i.e. it's size is 0. You may add terms to the term
vector with the predicates tv_add/2 or tv_set/3. You
may retrieve all terms of the vector by calling tv_list/2 and
you can access a single term with tv_get/3.
main(_) :-
my_findall(I, for(1,I,10), Numbers).
my_findall(Term, Goal, Terms) :-
% create a term vector ...
tv_create(Vector),
% .. . add a bulk of data to it ...
retrieve_info(Vector, Term, Goal),
% ... and collect all terms.
tv_list(Vector, Terms).
retrieve_info(Vector, Term, Goal) :-
% call a goal ...
call(Goal),
% ... store the information ...
tv_add(Vector, Term),
% ... and backtrack until there are no more results.
fail.
retrieve_info(_, _, _).
tv_add/2
tv_create/1
tv_get/3
tv_list/2
tv_set/3
tv_setsize/2
tv_size/2
Darueber
read on...