[LON-CAPA-users] Preprocessor vs. Custom Response

Jacob Bond bond13 at purdue.edu
Fri Dec 4 11:58:33 EST 2015


I have a stylistic question about preprocessing versus custom response.  An example of the particular situation is that I have a question whose answer is a rational number, say 5/2.  I would like either 5/2 or 2.5 to be accepted, but only these two answers.  I don't want 10/4 or 2.50 to be accepted.  My current approach (based on the discouragement of custom response problems from the manual because they can't be statistically analyzed) is to use a string response with answer 5/2 and a preprocessor that does the following:

if ($response eq 2.5) {return 5/2;}
else {return $response;}

Is this considered bad form?  Should I be using a custom response instead?  Is there another approach that would be better?

Thanks,
Jacob Bond


More information about the LON-CAPA-users mailing list