[ Type Testing | Reference Manual | Alphabetic Index ]

is_array(?Term)

Succeeds if Term is an array.
Term
Prolog term.

Description

Used to test whether Term is an array, i.e. a term with functor []/N. Could be defined as:
	is_array(X) :- nonvar(X), functor(X, [], _).
Note that this includes the empty array [].

Modes and Determinism

Fail Conditions

Fails if Term is not an array

Examples

    ?- is_array([]).
    Yes (0.00s cpu)

    ?- is_array([](1,2,3)).
    Yes (0.00s cpu)

    ?- is_array([1,2,3]).
    No (0.00s cpu)

    ?- is_array(f(1,2)).
    No (0.00s cpu)

    ?- is_array(foo).
    No (0.00s cpu)

    ?- is_array(_).
    No (0.00s cpu)

See Also

atom / 1, callable / 1, compound / 1, is_list / 1, ground / 1