We recently ran into an issue when testing Rubi on older versions. It boils down to this simple example which I didn't dare to simplify further as I cannot test it in versions < 10
Test[XXX[expr_, x_], n_Integer : Infinity, OptionsPattern[]] := True /;
Head[x] === Symbol && n > 0;
Test[___] := False;
XXX[blub, x] // Test
The important part is n
in the pattern and it should say
n
is an integern
is optional anInfinity
per defaultn
must be greater zero
Above code gives False
in versions 8 and 9, but True
in version 10 and 11. I'm not looking for a workaround, but I'd like to understand why it returns False
in the older versions.
Maybe someone who still has access can give me some insight.
Infinity
does not have the headInteger
. I believe they relaxed the pattern matcher in M10 to allow such patterns. $\endgroup$ – Carl Woll Aug 18 '18 at 8:20f[x_Integer: "Error"] := x; f[]
returns "Error" although it also has not theInteger
head. $\endgroup$ – halirutan♦ Aug 18 '18 at 8:22