
bag_create(-BagHandle)

   Create a bag object which can store data across failures

Arguments
   BagHandle           A free variable

Type
   Non-logical Variables, Arrays, Bags and Shelves

Description
    	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.
    

Resatisfiable
   No

Fail Conditions
   None

Exceptions
     5 --- BagHandle is not a variable

Examples
   
    simple_findall(Goal, Solutions) :-
    	bag_create(Bag),
	(
	    call(Goal),
	    bag_enter(Bag, Goal),
	    fail
	;
	    true
	),
	bag_dissolve(Bag, Solutions).
    

See Also
   bag_enter / 2, bag_dissolve / 2, bag_retrieve / 2, bag_abolish / 1
