The issue is the following, with a dumb function with (4) arguments of (4) different heads (for each head is always no grater than one arguments):

func[x_a,y_b,z_c,w_d] := Print[x,y,z,w]

If I type func[a[1],b[2],c[3],d[4]], it returns as its correct a[1]b[2]c[3]d[4].

But if I forget the order of I should type de arguments, It doesn't works. So, I want to my function func still works even if I send the exchanged arguments, a permutation of them. In spite of, coding all posible order for arguments in the func.

  • 3
    $\begingroup$ Attributes[func]={Orderless}. $\endgroup$ May 13 '15 at 18:43
  • 4
    $\begingroup$ If only wanting to handle a subset, could ue OrderlessPatternSequence (in version 10.1). func[x_a, OrderlessPatternSequence[y_b, z_c, w_d]] := Print[x, y, z, w] func[a[1], b[2], d[3], c[4]] a[1]b[2]c[4]d[3] $\endgroup$ May 13 '15 at 19:09
  • $\begingroup$ Thanks Fred. Your comment is actually the answer. $\endgroup$ May 13 '15 at 19:09
  • 2
    $\begingroup$ @d555: NB - you must set the attribute before setting any values of Fn you want it to apply to... $\endgroup$
    – ciao
    May 13 '15 at 22:08
  • 5
    $\begingroup$ I propose closing this as a duplicate of (71463) as between the question itself and my newly updated answer I believe this it well covered. $\endgroup$
    – Mr.Wizard
    May 17 '15 at 11:35