Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm unsuccessfully trying to compile this function

check[argA_, argB_] := argA[[1]] == argB[[1]];

assuming that both arguments argA and argB are of the form

{Real, String, ....}

Neither

cf = Compile[
{
{x, {_Real, _String}, 1},
{y, {_Real, _String}, 1}
},
x[[1]] == y[[1]]
];

nor

cf = Compile[
{
{x, {_Real, _String}, {1}},
{y, {_Real, _String}, {1}}
},
x[[1]] == y[[1]]
];

work as expected, and I can't see the underlying rule. I'm grateful for any explaination.

share|improve this question
1  
Can't mix types like that directly (from the docs: "assumes that Subscript[x, i] is a rank Subscript[n, i] array of objects, each of a type that matches Subscript[t, i]. " (emphasis mine). –  rasher Apr 27 at 21:26
2  
Strings cannot be compiled. –  RunnyKine Apr 27 at 21:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.