## WeBWorK Problems

### Bug in Set cmp? / Ellipsis in answer

by Alex Jordan -
Number of replies: 1
I am having a problem that I have tried to boil down to the minimal working example below. For a calculus course, I would like students to enter the first several values of a sequence. I would like them to use braces, as in {1, 2, 3}, to enter their answer. I can force this by defining the answer to be a Set MathObject, with braces as the corresponding parens.

I am unable to change the list_type to be "a sequence" rather than "an interval, set, or union". This means that if students enters something like "x" or "1, 2, 3", rather than "{1, 2, 3}", they are given confusing error messages:
I would want this to say

I believe I am passing the appropriate parameters to the cmp call, so I have begun to wonder if there is a typo somewhere in the parser for the Set object. My MWE is short, so I'll just paste it here rather than attach it

DOCUMENT();
"PGstandard.pl",
"MathObjects.pl",
);
##############################################
Context("Numeric");
Context()->parens->set('{'=>{type=>Set});
$answer = Set(1,2,3); ############################################## Context()->texStrings; BEGIN_TEXT Enter the sequence $$LBRACE 1, 2, 3RBRACE$$.$PAR
\{ans_rule(10)\}
END_TEXT
##############################################
ENDDOCUMENT();

Second question, related to this problem: is there a relatively straightforward way to implement an ellipsis as part of the answer to a question like this? I tried removing . as an operator and making ... a String in the context, but then I was unable to form a list of mixed type, e.g. {1, 2, 3, ...} has Reals and a String. I tried making ... into a Real constant, but ... is an illegal name for a constant.