WeBWorK Problems

Union.pm, development branch, 'union can be simplified by combining sets' error

Union.pm, development branch, 'union can be simplified by combining sets' error

by Andy Fuchs -
Number of replies: 3
We recently moved to the development branch of webwork and pg.

A small amendment in Union.pm seems to break apparently well written problems like 'Wiley/setAnton_Section_0.1/Question9f.pg' in the OPL, where, when students enter disjoint unions like '[-10,6) U (6,inf)', the system comes back with 'Your union can be simplified by combining some sets'. The code in question, in the 'isReduced' subroutine, is as follows:

[root@gauss Value]# diff Union.pm.gauss Union.pm.euclid
270a271,276
> if ($S.length) {
> foreach my $x (@{$sU->{data}}) {
> my $y = ($x + $S)->reduce;
> if ($y->type ne 'Union' || $y->length != $S->length) {$error = "uncombined sets"; last}
> }
> }

It's a simple matter for me to bypass this code... and I haven't yet had the chance to understand the purpose of the amendment--but thought that someone more familiar would easily see why this is happening.

Again, it's not critical--and please let me know if it's better to make such posts to bugs.webwork.maa.org

Many thanks for the help,

Andy
In reply to Andy Fuchs

Re: Union.pm, development branch, 'union can be simplified by combining sets' error

by Davide Cervone -
OOPS! I have been doing too much javascript programming. The $S.length should be $S->length. The condition about $y->length was also wrong.

I've made a pull request with the fix. Can you try out the change and see if that fixes things for you?

Thanks for reporting the problem.
In reply to Davide Cervone

Re: Union.pm, development branch, 'union can be simplified by combining sets' error

by Andy Fuchs -
Yes, perfect!

I might've noticed the dot notation, too...

Thanks!

In reply to Andy Fuchs

Re: Union.pm, development branch, 'union can be simplified by combining sets' error

by Michael Gage -
The fix for this has been included in release 2.13.