0

I want to test if an expression is a vector of all reals. I defined

RealVector[expr_]:=VectorQ[expr,NumberQ[#]&&(Head[#]===Real)];

Trying this on

RealVector[{1,2,3}]; RealVector[{1.,2.,3.}];

should return False and True, resp., but I get False and False. I do not understand what is wrong. Can you help me to fix it?

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263

0 Answers0