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

stored_keys(+StoreHandle, -Keys)

Retrieve all keys stored in a store object
StoreHandle
A store handle or store name
Keys
A variable or list

Description

This retrieves a list of all keys under which entries are stored in the given store object. If the store is empty, the empty list is returned.

The order of the keys in the returned list is undefined.

The complexity of this operation is linear in the size of all keys, since they need to be copied.

Note: If StoreHandle is not a handle, then it must be an atom or a compound term, and the store is identified by this term's toplevel functor together with the context module.

Modes and Determinism

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

Exceptions

(4) instantiation fault
StoreHandle is uninstantiated
(5) type error
StoreHandle is neither atom nor compound term nor store handle
(45) named object does not exist
StoreHandle is not the name of a store

Examples


    ?- store_create(Handle),
       store_set(Handle, tom, 12345),
       store_set(Handle, name(dick,tracy), phone(42376,home)),
       store_set(Handle, numbers:prime, [2,3,5,7|_More]),
       stored_keys(Handle, Keys).

    Handle = $&(store,"17h3")
    Keys = [numbers:prime, tom, name(dick, tracy)]
    Yes (0.00s cpu)
    

See Also

store / 1, store_create / 1, store_contains / 2, store_count / 2, store_delete / 2, store_erase / 1, store_get / 3, store_inc / 2, store_insert / 3, store_remove / 3, store_set / 3, store_test_and_set / 4, store_update / 4, stored_keys_and_values / 2