6.68 common signature definitions

see tutorial/PatternsOverview this below from tutorial/PuttingConstraintsOnPatterns

See also what-is-the-recommended-way-to-check-that-a-list-is-a-list-of-numbers-in-argumen

6.68.1 some signatures collection

integer
foo[(x_)?(Element[#1, Integers] & )] := x 
foo[x_Integer] := x 
foo[x_Integer] := x
 
integer strictly positive
foo[(x_)?(IntegerQ[#1] && #1 > 0 & )] := x 
foo[x_Integer /; x > 0] := x 
foo[(x_Integer)?Positive] := x 
foo[x_Integer /; x > 0] := x
 
integer strictly negative
foo[(x_)?(IntegerQ[#1] && #1 < 0 & )] := x 
foo[x_Integer /; x < 0] := x 
foo[(x_Integer)?Negative] := x 
foo[x_Integer /; x < 0] := x
 
integer zero or positive
foo[(x_)?(IntegerQ[#1] && #1 >= 0 & )] := x 
foo[x_Integer /; x >= 0] := x 
foo[(x_Integer)?NonNegative] := x 
foo[x_Integer /; x >= 0] := x
 
integer zero or negative
foo[(x_)?(IntegerQ[#1] && #1 <= 0 & )] := x 
foo[x_Integer /; x <= 0] := x 
foo[(x_Integer)?NonPositive] := x 
foo[x_Integer /; x <= 0] := x
 
integer in some range
foo[x_Integer /; x > 3 && x < 7] := x
 
Real
foo[x_?(Element[#, Reals] &)] := x 
foo[x_Real] := x
 
Real strictly positive
foo[x_Real /; x > $MachineEpsilon] := x 
foo[x_Real /; x > $MachineEpsilon] := x 
foo[x_Real /; Positive[x]] := x 
foo[x_ (Element[#, Reals] && Positive[#] &)] := x
 
Real strictly negative
foo[x_Real /; x < $MachineEpsilon] := x 
foo[x_Real /; x < $MachineEpsilon] := x 
foo[x_Real /; Negative[x]] := x 
foo[x_?(Element[#, Reals] && Negative[#] &)] := x
 
Real zero or positive
foo[x_Real /; x >= $MachineEpsilon] := x 
foo[x_Real /; x >= $MachineEpsilon] := x 
foo[x_Real /; Positive[x] || x == 0] := x 
foo[x_ (Element[#, Reals] && (Positive[#] || # == 0) &)] := x
 
Real zero or negative
foo[x_Real /; x <= $MachineEpsilon] := x 
foo[x_Real /; x <= $MachineEpsilon] := x 
foo[x_Real /; Negative[x] || x == 0] := x 
foo[x_ (Element[#, Reals] && (Negative[#] || # == 0) &)] := x
 
Real in some range
foo[x_ (Element[#, Reals] && ((# - 3) > $MachineEpsilon && (7 - #) > $MachineEpsilon) &)] := x 
foo[x : _Real /; (x - 3) > $MachineEpsilon && (7 - x) > $MachineEpsilon] := x
 
Boolean
foo[x_?(Element[#, Booleans] &)] := x
 
any numerical parameter
foo[x_?(Element[#, Reals] &)] := x 
foo[x_?(NumericQ[#] &)] := x 
foo[x : _?NumericQ] := x
 
checks for Head Real, Integer, Ratioal and Complex
foo[x_?(NumberQ[#] &)] := x
 
general complex number
foo[x_Complex] := x 
foo[x_?(Not@FreeQ[#, _Complex] &)] := x
 
list of any dimension, ragged lists, 1D vectors, 2D, any content
foo[x_List] := x
 
1D list (i.e. vector)
foo[x_?(VectorQ[#] &)] := x
 
Numeric 1D list
foo[x_?(VectorQ[#, NumericQ] &)] := x
 
Numeric 1D list
foo[x_?(VectorQ[#, NumericQ] &)] := x 
foo[x : {_?NumericQ ..}] := x 
foo[x : {__?NumericQ }] := x 
foo[x_?(VectorQ[#, IntegerQ] &)] := x
 
2D matix of numbers
foo[x_?(MatrixQ[#, NumericQ] &)] := x 
foo[x : {{_?NumericQ ..}}] := x 
foo[x : {{__?NumericQ }}] := x
 
2D matrix numeric but contains no complex numbers
foo[x_?(MatrixQ[#, NumericQ] && FreeQ[#, _Complex] &)] := x
 
2D matrix of strings
foo[x_?(MatrixQ[#, StringQ] &)] := x