Skip to content

VectorQ

Tests whether an expression is a flat (non-nested) list.

$ wo 'VectorQ[{1, 2, 3}]'
True
$ wo 'VectorQ[{{1, 2}, {3, 4}}]'
False

The two-argument form additionally requires every element to satisfy a test.

$ wo 'VectorQ[{1, 2, x}, NumberQ]'
False
$ wo 'VectorQ[{1, 2, 3}, Positive]'
True