Mutable Terms

Author(s): Rémy Haemmerlé.

This module provides mutable terms i.e. an abstract datatype provides with efficient backtrackable destructive assignment. In other words, any destructive assignments are transparently undone on backtracking. Modifications that are intended to survive backtracking must be done by asserting or retracting dynamic program clauses instead. Mutable must be prefered to destructive assignment of arbitrary terms using setarg/3 of the module odd which does not have safe semantics.

Usage and interface

Documentation on exports

PREDICATE

Usage:create_mutable(Datum,Mutable)

Unifies Datum with a freshly created mutable term with initial value Datum.

    PREDICATE

    Usage:get_mutable(Datum,Mutable)

    Unifies Datum with the current value of the mutable term Mutable. Mutable must be a mutable term.

      PREDICATE

      Usage:update_mutable(Datum,Mutable)

      Updates the current value of the mutable term Mutable to become Datum. Mutable must be a mutable term.

        PREDICATE

        Usage:mutable(Term)

        Succeeds if Term is currently instantiated to a mutable term.