[ Non-logical Variables, Arrays, Bags, Shelves and Stores | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

# store_contains(+StoreHandle, ++Key)

Check for an entry in a store object

StoreHandle
  A store handle or store name
Key
  A ground term

## Description

This checks whether a given store object contains an entry for a given key. If so, the predicate succeeds, otherwise it fails.

The key can be arbitrarily complex, but must be a ground term.

The complexity of this operation is linear in the size of the key, since the key needs to be compared. For indexing purposes, a hash value is computed from the key, and the full depth of the key is taken into account.

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

- store_contains(+, ++) is semidet

### Modules

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

### Fail Conditions

The store does not contain an entry for Key

### Exceptions

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

## Examples

        ?- store_create(Handle),
           store_set(Handle, tom, 12345),
           store_contains(Handle, tom).

        Yes (0.00s cpu)

        ?- store_create(Handle),
           store_set(Handle, tom, 12345),
           store_contains(Handle, harry).

        No (0.00s cpu)

## See Also

store / 1, local / 1, store_erase / 1, store_set / 3, store_delete / 2, store_get / 3, stored_keys / 2, stored_keys_and_values / 2, store_create / 1, store_count / 2