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:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

These are not vectors:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Use specific tests to generalize or specialize:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Scope  (3)

Applications  (1)

Properties & Relations  (2)

See Also

MatrixQ  ArrayDepth  ArrayQ  Dimensions  AllTrue

Tutorials

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