16

6

The MMA docs state that "In matching patterns with Orderless functions, all possible orders of arguments are tried".

Why then does the following not work?

```
plus[x__Integer, y__Real] := x+y
Attributes[plus] = {Orderless}
plus[2.5, 3]
```

Got:

```
plus[2.5, 3]
```

Expected:

```
5.5
```

Note that the expression does match the pattern.

```
MatchQ[plus[2.5, 3], plus[x__Integer, y__Real]]
```

returns `True`

if and only if `plus`

has the `Orderless`

Attribute.

Related: (304), (5067), (18060)

– Mr.Wizard – 2015-01-10T15:53:25.533