
bag_enter(+BagHandle, +Term)

   Enter a term into an existing bag object

Arguments
   BagHandle           A bag
   Term                An arbitrary term

Type
   Non-logical Variables, Arrays, Bags, Shelves and Stores

Description
    	This enters an arbitrary term into a bag object that has previously
	been created with bag_create/1. The order in which terms are entered
	into a bag should not be considered relevant, a bag is conceptually
	unordered. Entering and retrieving terms from a bag involves
	copying the term each time, similar to what happens in setval/getval
	and record/recorded. In particular, if the term contains variables,
	they lose their identity and are replaced with fresh ones.
    

Modes and Determinism
   bag_enter(+, +) is det

Exceptions
     4 --- BagHandle is not instantiated
     5 --- BagHandle is not a bag
    40 --- BagHandle refers to an already destroyed bag

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

See Also
   bag_create / 1, bag_count / 2, bag_abolish / 1, bag_erase / 1, bag_retrieve / 2, bag_dissolve / 2
