unorderedAnswer.pl - allow the answers to be checked independent of order.
UNORDERED_ANS(checker1, checker2, ...);
UNORDERED_NAMED_ANS(name1 => checker1, name2 => checker2, ...);
Routines for groups of answer blanks where the user can enter answers in any order in the blanks.
Collect a group of answer checkers for use with answers that can be given in any order. If N
answer checkers are given, then the last N
answer rules will be used. It is beter to use named rules and UNORDERED_NAMED_ANS
below. Otherwise, be sure to use UNORDERED_ANS
right after the answer rules for the answers you want to compare.
Format:
UNORDERED_ANS(checker1, checker2, ...);
Example:
BEGIN_PGML
The function [`f(x) = \frac{1}{x^2-$a}`] is defined except
for [`x =`] [___] and [`x = `] [___]
END_PGML
UNORDERED_ANS(std_num_cmp(sqrt($a)), std_num_cmp(-sqrt($a)));
(the student can enter the solutions in either order.)
Collect a group of answer checkers for use with named answers that can be given in any order.
Format:
UNORDERED_NAMED_ANS(name1 => checker1, name2 => checker2, ...);
Example:
BEGIN_PGML
The function [`f(x) = \frac{1}{x^2-$a}`] is defined except
for [`x = `] [@ NAMED_ANS_RULE(A1,10) @]
and [`x =`] [@ NAMED_ANS_RULE(A2,10) @]
END_PGML
UNORDERED_NAMED_ANS(
A1 => std_num_cmp(sqrt($a)),
A2 => std_num_cmp(-sqrt($a))
);
(the student can enter the solutions in either blank.)