I was wondering if there was a more elegant way of finding whether an element exists in an N-dimensional array. The way I would do it is:
inArrayQ[a_,el_] := If[Length@Position[a,x_/;x==el]==0,False,True];
But this seems rather cumbersome. I am surprised there is no built-in Mathematica function that does this, but if not, is there a better way to write such a function?
MemberQ
$\endgroup$MemberQ
you get the answer right away ;) $\endgroup$Position
to determine where the element is. $\endgroup$