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

rerecord(+Key, ?Value)

Erases all entries recorded under the key Key and replaces them with the given value Value.
+Key
An atom or a compound term.
+Value
Any prolog term.

Description

Used to erase all values associated with Key and then record the term Value under the key Key. If Key does not exist previously, it will record Value under Key in the indexed database. In the case of compound terms, all keys of the same name and arity are treated as equal.

Backtracking through a call of rerecord/2 does not undo erasure of the erased values and the value Value is not removed.

Fail Conditions

None.

Resatisfiable

No.

Exceptions

(4) instantiation fault
Key is not instantiated.
(5) type error
Key is neither an atom nor a compound term.

Examples

   Success:
   [eclipse]: record(beer,lowenbrau),
   >        record(beer,paulaner),
   >        record(beer,spaten),
   >        rerecord(beer,guinness).
   yes.
   [eclipse]: recorded(beer,Value).
   Value = guinness     More? (;)
   no (more) solution.
   [eclipse]: erase_all(beer),rerecord(beer,guinness).
   yes.
   [eclipse]: recorded(beer,guinness).
   yes.
   Error:
   rerecord(Beer,anything).                (Error 4)
   rerecord(1,anything).                   (Error 5)
   rerecord(1.0,anything).                 (Error 5)
   rerecord("str",anything).               (Error 5)



See Also

erase_all / 1