I have part of a code that looks like this:
horpatt = (* some code giving a List of n elements *);
verpatt = (* some code giving a List of n elements *);
tabpatt = Riffle[horpatt, verpatt] (* some ReplaceAll code *);
It is run several times with different values of the first two variables. Sometimes it produces this warning:
Riffle::rspec:
The third argument {2,-1,2} should be a positive integer or a list with three integers
which doesn't seem to be documented anywhere on the Internet. I try to see what might be wrong with the first two variables with the following code:
tabpatt = Check[
Riffle[horpatt, verpatt] (* some code *),
riffletrack = {horpatt, verpatt}; Abort[]
];
riffletrack
gives me exact values of horpatt
and verpatt
that causes the warning. But when I try those values, the warning doesn't actually occur.
horpatt = {{"S", "Q", "U", "I", "Z"}, {"V", "U", "L", "G", "O"}, {Null, "O", Null, "G", "O"}, {"S", "T", "E", "E", "N"}, {Null, "H", Null, "D", "S"}};
verpatt = {{"S", "V", Null, "S", Null}, {"Q", "U", "O", "T", "H"}, {"U", "L", Null, "E", Null}, {"I", "G", "G", "E", "D"}, {"Z", "O", "O", "N", "S"}};
tabpatt = Riffle[horpatt, verpatt] /. Null -> _
Even more strangely,
Riffle[horpatt, verpatt, {2, -1, 2}] /. Null -> _
doesn't produce a warning, but a desired result that is identical to both of the following:
Riffle[horpatt, verpatt] /. Null -> _
Riffle[horpatt, verpatt, {2, 10, 2}] /. Null -> _
I'm not even sure what questions to ask. Does Mathematica automatically insert {2, -1, 2}
as a third argument into Riffle
? The warning seems to suggest that such argument doesn't work but why does it work? Why is there the warning in the first place? Should I always insert a proper third argument (akin to {2, 10, 2}
above) to avoid this seemingly random warning? Is this a bug?
I'm using Mathematica 10.0.2.0 for Mac.
Update
I have actually put {2, 10, 2}
as a third argument into my code:
tabpatt = Riffle[horpatt, verpatt, {2, 10, 2}] (* some ReplaceAll code *);
After many iterations, Mathematica eventually gives several instances of:
Riffle::rspec:
The third argument {2,10,2} should be a positive integer or a list with three integers
I'm pretty sure there's a bug in there somewhere.
x
andy
:Riffle[{1, 2, 3, 4, 5, 6, 7, 8, 9}, {x, y}, {5, -1, 2}]
." $\endgroup$Check
); running it again didn't. $\endgroup$