[ Non-logical Variables, Arrays, Bags, Shelves and Stores | Reference Manual | Alphabetic Index ]


Erase the contents of a bag
A bag handle


This explicitly erases the contents of a previously created bag object and frees the associated memory. After erasing, the bag is in the same state as immediately after creation, and can be filled with new contents.

Modes and Determinism


(4) instantiation fault
BagHandle is not instantiated
(5) type error
BagHandle is not a bag
(40) stale object handle
BagHandle refers to an already destroyed bag


    ?- bag_create(B), bag_enter(B, one), bag_erase(B), bag_enter(B, two), bag_retrieve(B, L).
    B = $&(bag,"371bnb")
    L = [two]
    Yes (0.00s cpu)

See Also

bag_create / 1, bag_abolish / 1, bag_enter / 2, bag_count / 2, bag_retrieve / 2, bag_dissolve / 2