I want to create my own functions AtomQ
and NumericQ
.
For example, I already create some functions (IntegerQ
,EvenQ
,OddQ
,PrimeQ
):
meuIntegerQ[_Integer] := True
meuIntegerQ[_] := False
meuEvenQ[n_Integer] /; Divisible[n, 2] := True
meuEvenQ[_] := False
meuOddQ[n_Integer] /; Divisible[n, 2] := True
meuOddQ[_] := False
meuPrimeQ[1] = False;
meuPrimeQ[2] = True;
meuPrimeQ[n_Integer /; n > 2] := Length[Divisors[n]] == 2
How can I create a function that does the same at AtomQ
and NumericQ
like the examples.
Ps: This is just for exercise.
True
forAtomQ
? $\endgroup$True
if expr is an expression which cannot be divided into subexpressions, and yieldsFalse
otherwise. " @JasonB. $\endgroup$AtomQ
$\endgroup$AtomQ
andNumericQ
? It is not possible to do this perfectly. These functions are too deeply intertwined with the rest of Mathematica. E.g. did you know you could assign to NumericQ and that it would affect other functions too? $\endgroup$