[ Recorded Database | Reference Manual | Alphabetic Index ]

erase(+Key, ?Value)

Succeeds if the term Value associated with key Key is removed as an entry from the record database.
Key
Atom, compound term, or handle.
Value
An arbitrary term.

Description

Finds the first term associated with Key that can be unified with Value and removes its entry from the record database. It fails if such an entry cannot be found. If Value is uninstantiated, the first value under the key Key is removed. In the case of compound terms, all keys of the same name and arity are treated as equal. Backtracking through calls of erase/2 does not undo an erasure.

Modes and Determinism

Modules

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

Fail Conditions

Fails if Value does not unify with any term recorded under the key Key

Exceptions

(4) instantiation fault
Key is not instantiated.
(5) type error
Key is neither atom, compound term, nor record handle.

Examples

   Success:
   [eclipse]: record(whiskey,jameson),
   >        record(whiskey,bushmills),
   >        record(whiskey,glenfiddich),
   >        record(whiskey,dimple).
   yes.
   [eclipse]: erase(whiskey,dimple),erase(whiskey,Value).
   Value = jameson
   yes.
   [eclipse]: recorded(whiskey,L).
   L = bushmills     More? (;)
   L = glenfiddich     More? (;)
   no (more) solution.
   Fail:
   erase(whiskey,jameson).
   Error:
   erase(Key,anything).                   (Error 4)
   erase("whiskey",anything).             (Error 5)



See Also

erase_all / 1, record_wait_remove / 3