[ Recorded Database | Reference Manual | Alphabetic Index ]

recorded(+Key, ?Value)

Succeeds if the term Value has been recorded in the indexed database under the key Key.
Key
An atom or a compound term.
Value
Any Prolog term.

Description

Used to find all values associated with a key. Unifies Value with the first term that has been associated with Key. In the case of compound terms, all keys of the same name and arity are treated as equal. If Value is instantiated, the instantiated term is used as a filter to reduce the number of terms returned by the recorded database and unified with Value, thus improving the speed of retrieving the term.

Backtracking will unify Value with successive values associated with Key in the order in which they were recorded.

Modes and Determinism

Modules

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

Fail Conditions

Fails if nothing is recorded under the key Key

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,paulaner),
   >        record(beer,lowenbrau),
   >        record(beer,spaten),
   >        recorded(beer,Value).
   Value = paulaner     More? (;)
   Value = lowenbrau     More? (;)
   Value = spaten     More? (;)
   no (more) solution.
   Fail:
   erase_all(beer),recorded(beer,guiness).
   Error:
   recorded(Beer,Value).                (Error 4)
   recorded("beer",Value).              (Error 5)
   recorded(1,Value).                   (Error 5)



See Also

record / 2