Basic term manipulation

Author(s): Daniel Cabeza, Manuel Hermenegildo.

This module provides basic term manipulation.

Usage and interface

Documentation on exports

PREDICATE=/2
X=Y

X and Y unify.

PREDICATE\=/2

Usage:ISOX\=Y

X and Y are not unifiable.

Other properties: X\=Y

  • If the following properties hold at call time:
    (term_typing:ground/1)X is currently ground (it contains no variables).
    (term_typing:ground/1)Y is currently ground (it contains no variables).
    then the following properties hold globally:
    (basic_props:eval/1)X\=Y is evaluable at compile-time.
X\=Y

PREDICATEarg/3

Usage 1:arg(ArgNo,Term,Arg)

Usage 2:arg(ArgNo,Term,Arg)

Usage 3:ISOarg(ArgNo,Term,Arg)

Argument ArgNo of the term Term is Arg.

Usage 4:arg(ArgNo,Term,Arg)

PREDICATEfunctor/3

Usage 1:ISOfunctor(Term,Name,Arity)

Usage 2:ISOfunctor(Term,Name,Arity)

The principal functor of the term Term has name Name and arity Arity.

Usage 3:functor(Term,Name,Arity)

Other properties:

PREDICATE=../2

Usage:ISOTerm=..List

The functor and arguments of the term Term comprise the list List.

Other properties:

  • If the following properties hold at call time:
    (term_typing:nonvar/1)Arg1 is currently a term which is not a free variable.
    then the following properties hold globally:
    (basic_props:eval/1)Arg1=..Arg2 is evaluable at compile-time.
Arg1=..List

Usage:non_empty_list(A)

A list that is not the empty list [].

    PREDICATEcopy_term/2

    Usage:ISOcopy_term(Term,Copy)

    Copy is a renaming of Term, such that brand new variables have been substituted for all variables in Term. If any of the variables of Term have attributes, the copied variables will have copies of the attributes as well. It behaves as if defined by:

    :- data 'copy of'/1.
    
    copy_term(X, Y) :-
            asserta_fact('copy of'(X)),
            retract_fact('copy of'(Y)).
    

    Other properties: copy_term(Term,Copy)

    • If the following properties hold at call time:
      (term_typing:ground/1)Term is currently ground (it contains no variables).
      then the following properties hold globally:
      (basic_props:eval/1)copy_term(Term,Copy) is evaluable at compile-time.

    Usage:copy_term_nat(Term,Copy)

    Same as copy_term/2, except that attributes of variables are not copied.

    • The following properties hold globally:
      (basic_props:sideff/2)copy_term_nat(Term,Copy) is side-effect free.

    PREDICATEcyclic_term/1

    Usage:cyclic_term(T)

    True if T is cyclic (infinite).

      PREDICATEC/3

      Usage 1:C(S1,Terminal,S2)

      Usage 2:C(S1,Terminal,S2)

      S1 is connected by the terminal Terminal to S2. Internally used in DCG grammar rules. Defined as if by the single clause: 'C'([X|S], X, S).

      Other properties: C(S1,Terminal,S2)

      • If the following properties hold at call time:
        (term_typing:nonvar/1)Arg1 is currently a term which is not a free variable.
        then the following properties hold globally:
        (basic_props:eval/1)C(Arg1,Arg2,Arg3) is evaluable at compile-time.

      PREDICATEconst_head/1
      No further documentation available for this predicate.

      A regular type, defined as follows:
      list_functor([A|B]) :-
              term(A),
              term(B).
      

      Documentation on imports

      This module has the following direct dependencies: