| … | |
… | |
| 251 | !$ans->{isPreview} && !Value::isFormula($student); |
251 | !$ans->{isPreview} && !Value::isFormula($student); |
| 252 | if ($student->type eq 'Union' && $student->length >= 2) { |
252 | if ($student->type eq 'Union' && $student->length >= 2) { |
| 253 | my $reduced = $student->reduce; |
253 | my $reduced = $student->reduce; |
| 254 | return "Your$nth union can be written in a simpler form" |
254 | return "Your$nth union can be written in a simpler form" |
| 255 | unless $reduced->type eq 'Union' && $reduced->length == $student->length; |
255 | unless $reduced->type eq 'Union' && $reduced->length == $student->length; |
| 256 | my @R = sort {$a <=> $b} $reduced->value; |
256 | my @R = $reduced->sort->value; |
| 257 | my @S = sort {$a <=> $b} $student->value; |
257 | my @S = $student->sort->value; |
| 258 | foreach my $i (0..$#R) { |
258 | foreach my $i (0..$#R) { |
| 259 | return "Your$nth union can be written in a simpler form" |
259 | return "Your$nth union can be written in a simpler form" |
| 260 | unless $R[$i] == $S[$i]; |
260 | unless $R[$i] == $S[$i]; |
| 261 | } |
261 | } |
| 262 | } elsif ($student->type eq 'Set') { |
262 | } elsif ($student->type eq 'Set') { |