[ The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

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

Built-ins to store data across backtracking

Predicates

local array(+Array)
Creates the untyped non-logical array Array.
local array(+Array, +Type)
Creates a non-logical array Array with given Type.
bag_abolish(+BagHandle)
Destroy a bag explicitly
bag_count(+BagHandle, ?Count)
Get the number of entries in a bag
bag_create(-BagHandle)
Create a bag object which can store data across failures
bag_dissolve(+BagHandle, ?List)
Retrieve a bag's contents and destroy the bag
bag_enter(+BagHandle, +Term)
Enter a term into an existing bag object
bag_erase(+BagHandle)
Erase the contents of a bag
bag_retrieve(+BagHandle, ?List)
Retrieve a bag's contents
current_array(?Array, ?Options)
Succeeds if there exists an array as denoted by Array and with type and visibility as given in the list Options.
current_store(?StoreHandle)
StoreName is a visible store name
decval(+ElemSpec)
Decrements the contents of the visible non-logical variable or array element ElemSpec by one.
erase_array(+ArraySpec)
Erases existing visible array, non-logical variable or reference.
getval(+ElemSpec, ?Value)
Retrieves the value of the visible array element, non-logical variable or reference ElemSpec
incval(+ElemSpec)
Increments the contents of the visible non-logical variable or array element ElemSpec by one.
local reference(+Name)
Creates a named reference called Name.
setval(+ElemSpec, ?Value)
Sets the value of a non-logical variable, array element, or reference to the value Value.
shelf_abolish(+ShelfHandle)
Destroy a shelf explicitly
shelf_create(+InitTerm, -ShelfHandle)
Create a shelf object which can store data across failures
shelf_create(++ShelfSpec, ?SlotInit, -ShelfHandle)
Create a shelf object which can store data across failures
shelf_get(+ShelfHandle, +Index, -Term)
Retrieve a stored term from a shelf object
shelf_set(+ShelfHandle, +Index, ?Term)
Store a term in a shelf object
local store(++Name)
Create a named store object which can store indexed data across failures
store_contains(+StoreHandle, ++Key)
Check for an entry in a store object
store_count(+StoreHandle, ?Count)
Retrieve the number of entries in a store object
store_create(-StoreHandle)
Create an anonymous store object which can store indexed data across failures
store_delete(+StoreHandle, ++Key)
Delete an entry in a store object
store_erase(+StoreHandle)
Erase the contents of the specified store object
store_get(+StoreHandle, ++Key, ?Value)
Look up an entry in a store object
store_inc(+StoreHandle, ++Key)
Increment an integral entry within a store object
store_set(+StoreHandle, ++Key, ?Value)
Make an entry into a store object
stored_keys(+StoreHandle, ?Keys)
Retrieve all keys stored in a store object
stored_keys_and_values(+StoreHandle, ?KeysValues)
Retrieve all data stored in a store object
test_and_setval(+VarName, +Old, +New)
Test whether a non-logical variable has value Old and if so, set it to New.
local variable(+Name)
Creates the untyped non-logical variable Name.

Description

ECLiPSe provides several facilities to store information across backtracking. The following table gives an overview. If at all possible, the handle-based facilities (bags and shelves) should be preferred because they lead to cleaner, reentrant code (without global state) and reduce the risk of memory leaks.
    Facility        Type            Reference       See
    ================================================================
    shelves         array           by handle       shelf_create/2,3
    ----------------------------------------------------------------
    bags            unordered bag   by handle       bag_create/1
    ----------------------------------------------------------------
    stores          hash table      by handle       store_create/1
    ----------------------------------------------------------------
    named stores    hash table      by name         store/1
    ----------------------------------------------------------------
    non-logical     single cell     by name         variable/1
    variables
    ----------------------------------------------------------------
    non-logical     array           by name         array/1,2
    arrays
    ----------------------------------------------------------------
    records         ordered list    by name         record/1,2
    ----------------------------------------------------------------
    dynamic         ordered list    by name         dynamic/1,assert/1
    predicates
    ----------------------------------------------------------------

Generated from arrays.eci on Sat Aug 7 01:44:12 2004