Meta-Logical

KEY var(X) Tests whether X is currently instantiated to a variable. nonvar(X) Tests whether X is currently instantiated to a non-variable term. atom(X) Checks that X is currently instantiated to an atom (i.e. a non-variable term of arity 0, other than an integer). integer(X) Checks that X is currently instantiated to an integer. atomic(X) Checks that X is currently instantiated to an atom or integer. X == Y Tests if the terms currently instantiating X and Y are literally identical (in particular, variables in equivalent positions in the two terms must be identical). X \== Y Tests if the terms currently instantiating X and Y are not literally identical. functor(T,F,N) The principal functor of term T has name F and arity N, where F is either an atom or, provided N is 0, an integer. Initially, either T must be instantiated to a non-variable, or F and N must be instantiated to, respectively, either an atom and a non-negative integer or an integer and 0. If these conditions are not satisfied, an error message is given. In the case where T is initially instantiated to a variable, the result of the call is to instantiate T to the most general term having the principal functor indicated. arg(I,T,X) Initially, I must be instantiated to a positive integer and T to a compound term. The result of the call is to unify X with the Ith argument of term T. (The arguments are numbered from 1 upwards.) If the initial conditions are not satisfied or I is out of range, the call merely fails. X =.. Y Y is a list whose head is the atom corresponding to the principal functor of X and whose tail is the argument list of that functor in X. E.g. product(0,N,N-1) =.. [product,0,N,N-1] N-1 =.. [-,N,1] product =.. [product] If X is instantiated to a variable, then Y must be instantiated either to a list of determinate length whose head is an atom, or to a list of length 1 whose head is an integer. name(X,L) If X is an atom or integer then L is a list of the ASCII codes of the characters comprising the name of X. E.g. name(product,[112,114,111,100,117,99,116]) i.e. name(product,"product") name(1976,[49,57,55,54]) name(hello,[104,101,108,108,111]) name([],"[]") If X is instantiated to a variable, L must be instantiated to a list of ASCII character codes. E.g. | ?- name(X,[104,101,108,108,111])). X = hello | ?- name(X,"hello"). X = hello call(X) If X is instantiated to a term which would be acceptable as body of a clause, the goal call(X) is executed exactly as if that term appeared textually in place of the call(X). In particular, any cut ("!") occurring in X is interpreted as if it occurred in the body of the clause containing call(X), unless that clause is a compiled clause, in which case only the alternatives in the execution of X are cut. If X is not instantiated as described above, an error message is printed and call fails. X (where X is a variable) Exactly the same as call(X).