Miscellaneous ISO Prolog predicates

Author(s): Daniel Cabeza.

This module implements some miscellaneous ISO Prolog predicates.

Usage and interface

Documentation on exports

PREDICATE
once(G)

Finds the first solution of goal G (if any). once/1 behaves as call/1, except that no further solutions are explored on backtracking.

Usage:ISO

  • The following properties should hold at call time:
    (basic_props:callable/1)G is a term which represents a goal, i.e., an atom or a structure.
Meta-predicate with arguments: once(goal).

PREDICATE
compound(T)

T is currently instantiated to a compound term.

Usage:ISO

  • Call and exit should be compatible with:
    (basic_props:term/1)T is any term.
  • The following properties should hold upon exit:
    (basic_props:term/1)T is any term.
    (basic_props:struct/1)T is a compound term.

PREDICATE
sub_atom(Atom,Before,Length,After,Sub_atom)

Is true iff atom Atom can be broken into three pieces, AtomL, Sub_atom and AtomR such that Before is the number of characters of the name of AtomL, Length is the number of characters of the name of Sub_atom and After is the number of characters of the name of AtomR

Usage:ISO

  • Call and exit should be compatible with:
    (basic_props:int/1)Before is an integer.
    (basic_props:int/1)Length is an integer.
    (basic_props:int/1)After is an integer.
    (basic_props:atm/1)Sub_atom is an atom.
  • The following properties should hold at call time:
    (basic_props:atm/1)Atom is an atom.
  • The following properties should hold upon exit:
    (basic_props:int/1)Before is an integer.
    (basic_props:int/1)Length is an integer.
    (basic_props:int/1)After is an integer.
    (basic_props:atm/1)Sub_atom is an atom.

PREDICATE
unify_with_occurs_check(X,Y)

Attempts to compute and apply a most general unifier of the two terms X and Y. Is true iff X and Y are unifiable.

Usage:ISO

  • Call and exit should be compatible with:
    (basic_props:term/1)X is any term.
    (basic_props:term/1)Y is any term.
  • The following properties should hold upon exit:
    (basic_props:term/1)X is any term.
    (basic_props:term/1)Y is any term.

Known bugs and planned improvements

  • There is a naive implementation of compound/1, perhaps is better to implement it as a builtin -- EMM.