Hi folks,
I would like to be able to assess answers that are sets and list of sets (perhaps even sets of sets). The discussion https://webwork.maa.org/moodle/mod/forum/discuss.php?d=2950 points out one way to do accomplish this, but the answer checking is not doing what I would hope. For instance, if the correct answer is the list of sets {A,B},{C,D} and a student enters {C,D},{A,B} then their answer will be marked correct (as expected), but if they enter {D,C},{A,B} their answer will be marked incorrect (not as expected). The problem below and attached exhibits this behavior (using pg 2.12) using strings added to the context. More generally, I would like to be able to do this using named matrices, permutations, etc., that have been added to the context (not just strings) because I am working on problems in abstract algebra (algebraic structures).
Thanks!
Paul
DOCUMENT();
loadMacros(
"PGstandard.pl",
"PGML.pl",
"contextArbitraryString.pl",
);
TEXT(beginproblem());
# https://webwork.maa.org/moodle/mod/forum/discuss.php?d=2950
Context("Numeric");
Context()->strings->add(
alpha => {caseSensitive => 1},
beta => {caseSensitive => 1},
gamma => {caseSensitive => 1},
delta => {caseSensitive => 1},
);
Context()->parens->set("{" => {type => "List", removable => 0});
$answer1 = Compute("{alpha,beta,gamma}");
$answer2 = Compute("{alpha,beta}, {gamma,delta}");
BEGIN_PGML
# Answer is a set of strings or several sets of strings
Using set notation, what is the set of the first three letters of the Greek alphabet in their natural order? [__________________]{$answer1->cmp(list_type=>"set", removeParens=>0, implicitList=>0, showParenHints=>1, ordered=>1)} Note: [| {beta, alpha, gamma} |] is marked incorrect (as expected).
Enter [| {alpha,beta}, {gamma,delta} |] [_____________________]{$answer2->cmp(list_type=>"set", removeParens=>0, implicitList=>0, showParenHints=>1)} Note: [| {gamma,delta}, {alpha,beta} |] is marked correct, but [| {delta,gamma}, {alpha,beta} |] is not marked correct (not as expected).
END_PGML
ENDDOCUMENT();