VectorQ

VectorQ[expr]

gives True if expr is a list or a onedimensional SparseArray object, none of whose elements are themselves lists, and gives False otherwise.

VectorQ[expr,test]

gives True only if test yields True when applied to each of the elements in expr.

Details

Examples

open allclose all

Basic Examples  (3)

Test whether an object is a vector:

These are not vectors:

Use specific tests to generalize or specialize:

Scope  (3)

Test for a vector of integers:

Test for a vector of machine-real numbers:

Test for a vector of real-valued numeric quantities:

Faster test for explicit real-valued numbers:

Applications  (1)

Define a function that only evaluates for vector arguments:

Numerically find the minimum of the functions with components:

Properties & Relations  (3)

VectorQ is a special case of ArrayQ:

A function equivalent to VectorQ:

VectorQ effectively uses AllowedHeads"ListLike":

Introduced in 1988
 (1.0)
 |
Updated in 2003
 (5.0)