[ Non-logical Variables, Arrays, Bags, Shelves and Stores | Reference Manual | Alphabetic Index ]
Create a bag object which can store data across failures
- A free variable
This creates an anonymous bag object which can be used to store
information across failures. A typical application is the
implementation of the findall/3 predicate or similar functionality.
Bags are similar to records, with two differences: First, a bag
is considered unordered, so one should not expect the bag content
to indicate the order in which information was entered.
Second, bags are referred to by handle, not by name, so they make
it much easier to write robust, reentrant code.
Modes and Determinism
- (5) type error
- BagHandle is not a variable
simple_findall(Goal, Solutions) :-
bag_erase / 1, bag_enter / 2, bag_count / 2, bag_dissolve / 2, bag_retrieve / 2, bag_abolish / 1