Thanks Davide - I edited the example to use $OK.


On Sat, Mar 22, 2014 at 2:44 AM, Davide P. Cervone <notifications@github.com
> wrote:

> In macros/bizarroArithmetic.pl:
>
> > +       4/2 x^2
> > +
> > +
> > +ANS($ans -> cmp(
> > +   checker=>sub{
> > +      my ( $correct, $student, $ansHash ) = @_;
> > +      return 0 if $ansHash->{isPreview} || $correct != $student;
> > +      $student = $ansHash->{student_formula};
> > +      $correct = $correct->{original_formula} if defined $correct->{original_formula};
> > +      $student = Formula("$student"); $correct = Formula("$correct");
> > +      return 0 unless ($correct == $student);
> > +      Context()->flags->set(bizarroDiv=>1);
> > +      delete $correct->{test_values}, $student->{test_values};
> > +      Value->Error("Your answer is correct, but please simplify it further")
> > +        unless (($correct == $student) or ($student == $correct));
> > +      Context()->flags->set(bizarroDiv=>0);
>
> Note that when the error message is given, your context will be left in
> the bizzaro state. So that could affect later answers checked by this
> method. So I'd recommend using $OK as you do in the checkers below in
> order to make sure that you restore the original flags.
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/openwebwork/pg/pull/115/files#r10861584>
> .
>



-- 
Alex Jordan
Mathematics Instructor
Portland Community College