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

Non-logical Variables, Arrays, Bags and Shelves

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_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_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.
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
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
    ----------------------------------------------------------------
    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 Wed May 15 03:40:09 2002