`parserMultiAnswer.pl`

macro file. You get access to the student answers through the custom `checker`

function that you provide. See the MultiAnswer documentation for details.
Here is an example of how to do this:

loadMacros( "PGstandard.pl", "MathObjects.pl", "PGML.pl", "parserMultiAnswer.pl", "PGcourse.pl" ); Context("Interval"); $A = Compute("{1,2,3,4}"); $B = Compute("{3,4,5,6,7,8}"); $ma = MultiAnswer($A,$B)->with( singleResult => true, format => "A = %s and B = %s", tex_format => "A = %s\hbox{ and }B = %s", checker => sub { my ($correct, $student, $m, $ans) = @_; my ($A, $B) = @$student; if (!$ans->{isPreview}) { Value->Error("A doesn't have 4 elements") if $A->length != 4; Value->Error("B doesn't have 6 elements") if $B->length != 6; Value->Error("The union doesn't have 8 elements") if ($A + $B)->length != 8; } return $A->length == 4 && $B->length == 6 && ($A + $B)->length == 8; } ); BEGIN_PGML Give an example of sets [`A`] and [`B`] of numbers with [`|A| = 4`], [`|B| = 6`], and [`|A \cup B| = 8`]. >> [`A`] = [______________]{$ma} and [`B`] = [_______________]{$ma} << END_PGMLNote that I have specified "set of numbers" in the problem because MathObejct sets are only for real numbers. I hope that answers the question.