typeMatch
option to the cmp()
call, as in
ANS($answer->cmp(typeMatch=>Formula("x")));But with the MultiAnswer object, you don't make the individual
cmp()
calls yourself, so you can't add that option.
In your case, you could handle it by overriding the default typeMatch
option for the String comparisons by adding
Context()->{cmpDefaults}{String} = {typeMatch=>Formula("x")};to your Context setup code. This will make all string comparisons be done with messages appropriate for formulas rather than numbers.
If you have more than one string answer and need a different type for each, then you would have to be more sophisticated about it. I don't want to complicate this answer by writing that out as well unless you really need it. If so, let me know and I'll write that up, too.