## WeBWorK Problems

### Re: a weak alternative to a polymorphic custom checker

by Dick Lane -
Number of replies: 0
Thanks, Gavin, for your improvement to my stab at a suitable custom checker.  I didn't respond right after I read and tried it because I wanted to explore the ways in which your code was better.  I suspected the use of String was crucial and confirmed that.  Then I thought to make it more self-contained by not having the norm be obtained via reference to a global, so inserted a norm computation, e.g.,

ANS( $ab->cmp( checker=>sub { my ($c, $s,$ans ) = @_;
my  $nc = norm($c) ;
return  ( $nc &&$c == $s ) || ( !$nc && String("none") == \$s );
} ) );

Perhaps here, or after a further bit of tinkering, things went awry.  Part of my testing involved inserting an assignment so that the points would be collinear --- that condition had been recognized before but not after some recent change.  Even if I reverted to your code (pasted-in), what worked before did not now.

Hence, I am reverting to the version I had when writing my note: the problem template identifies, via the  if ... else  block, which of two states exist (the points determine a plane or are collinear) and then produces a single answer box which is associated with an appropriate checker (and causes the CORRECT item to be suitable --- I was not paying attention to that detail when your version worked initially, but suspect it showed <0,0,0> for the collinear case).

I find this a bit strange.  Although I did not keep written notes during my test of your version and my initial changes to it, I know collinearity was identified before it wasn't.  [I will keep one of the current strange versions to examine further when I am less rushed.]