I made a problem for which I would like either List(0,1,5,INF) or List(0,1,5,5,INF) to be acceptable solutions. I tried to write my own custom list checker based on what I read here:
https://webwork.maa.org/wiki/Custom_Answer_Checkers_for_Lists
However, when my code wasn't working, I tried to start with the simplest possible version - a custom list_checker that marks every answer correct, and even that is not working, so apparently I am misunderstanding something fundamental, and I cannot figure out what.
Here's my code:
DOCUMENT();
loadMacros(
"PGstandard.pl", # Standard macros for PG language
"PGML.pl", # PGML markup and Math Objects
"PGcourse.pl", # Customization file for the course
);
$ans1 = List(0, 1, 5, INF);
$ans2 = List(0, 1, 5, 5, INF);
sub mycheck1 {
my ($correct,$student,$ansHash,$value) = @_;
$result = ($ans1 == $correct || $ans2 == $correct);
return ($result, ());
}
BEGIN_PGML
I want either (0, 1, 5, INF) or (0, 1, 5, 5, INF) to be accepted as correct, but first I'm trying to make ANY ANSWER correct.
[_]{$ans1->cmp( list_checker=> sub{return (1, ());} );}
END_PGML
ENDDOCUMENT();