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.

DetailsDetails

ExamplesExamplesopen allclose all

Basic Examples  (3)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]=
Introduced in 1988
(1.0)
| Updated in 2003
(5.0)