I have not figured out how to use parserMultiAnswer.pl when the answer blanks which are tied together have some other answer in between. I gather that named answer rules need to be used, and that the namedRules option needs to be set to true.
I also searched the OPL and there are no instances of 'namedRules' so there isn't an example there I could mimic.
Is anyone able to tweak this minimal example so that it works? Right now it makes warning messages about no answer evaluator for the answer blanks.
DOCUMENT();
loadMacros("PGstandard.pl","MathObjects.pl","parserMultiAnswer.pl",);
TEXT(beginproblem());
Context('Numeric');
$a = Real(1);
$b = Real(2);
$c = Real(3);
$multians = MultiAnswer($a, $c)->with(
namedRules => 1,
checker => sub {
my ( $correct, $student, $self ) = @_;
my ( $astu, $cstu ) = @{$student};
if ( $astu + 2 == $cstu ) {
return [1,1];
} else {return [0,0];}
}
);
BEGIN_TEXT
Enter some number for \(a\): \{$multians->ans_rule(6)\}
$PAR
The number \(b\) is \(2\); enter \(2\) here: \{NAMED_ANS_RULE('b',6)\}
$PAR
The number \(c\) is \(a+b\); enter \(c\) here: \{$multians->ans_rule(6)\}
END_TEXT
NAMED_ANS($multians->cmp);
NAMED_ANS('b', $b->cmp);
ENDDOCUMENT();
loadMacros("PGstandard.pl","MathObjects.pl","parserMultiAnswer.pl",);
TEXT(beginproblem());
Context('Numeric');
$a = Real(1);
$b = Real(2);
$c = Real(3);
$multians = MultiAnswer($a, $c)->with(
namedRules => 1,
checker => sub {
my ( $correct, $student, $self ) = @_;
my ( $astu, $cstu ) = @{$student};
if ( $astu + 2 == $cstu ) {
return [1,1];
} else {return [0,0];}
}
);
BEGIN_TEXT
Enter some number for \(a\): \{$multians->ans_rule(6)\}
$PAR
The number \(b\) is \(2\); enter \(2\) here: \{NAMED_ANS_RULE('b',6)\}
$PAR
The number \(c\) is \(a+b\); enter \(c\) here: \{$multians->ans_rule(6)\}
END_TEXT
NAMED_ANS($multians->cmp);
NAMED_ANS('b', $b->cmp);
ENDDOCUMENT();