I have been trying to find a function which takes as its arguments , one integer, one approximate real number, one rationale number and one complex number. The order in which the arguments are specified is immaterial. The function produces the list exactly in the order in which the arguments are specified but no two arguments are of the same type.
I have tried to use Orderless and Cases as Mathematica functions but have not succeeded. I would like help in this.
ClearAll[f]
SetAttributes[f, Orderless]
f[n_Integer, r_Real, y_Rational, z_Complex] := {n, r, y, z}
f[2.5, 12, 11/5, 5 + I]
{12, 2.5, 11/5, 5 + I}
(* This does not work because the order in which the list appears is \
not the same order in which the arguments in the function appear *)
(* The following is fine *)
f[2, 12, 11/5, 5 + I]
f[2, 11/5, 5 + I, 12]
f[2, 3/4, 11/5, 5 + I]
f[3/4, 2, 11/5, 5 + I]