@@ -726,35 +726,41 @@ public void execute(BlockEvaluator blockEvaluator) {
726
726
}
727
727
}
728
728
729
- // = 61 new OP_Dot_Equals(),
729
+ // = - 61
730
730
class OP_Dot_Equals extends Operator {
731
-
731
+
732
732
public OP_Dot_Equals () {
733
733
init (".=" );
734
- arg ("LL|AL|LA" , "element-wise equivalence" );
734
+ arg ("AA" , "equality (vectorized)" );
735
+ vect ();
735
736
}
736
737
738
+ private static NumberListOp NUML_OP = new NumberListOp () {
739
+ public NumberList ln (NumberList a , Number b ) { return a .eq (b );}
740
+ public NumberList nl (Number a , NumberList b ) { return b .eq (a );}
741
+ public NumberList ll (NumberList a , NumberList b ) { return a .eq (b );}
742
+ public NumberList l (NumberList a ) { throw new UnimplementedError (); }
743
+ };
744
+
737
745
@ Override
738
746
public void execute (final BlockEvaluator blockEvaluator ) {
739
- final Obj a = blockEvaluator .pop ();
740
747
final Obj b = blockEvaluator .pop ();
741
-
742
- if (a .isa (DICT ) && b .isa (DICT )) {
743
- blockEvaluator .push (a .equiv (b ) ? Num .ONE : Num .ZERO );
744
- } else if (a .isa (LIST ) && b .isa (LIST )) {
745
- blockEvaluator .push (asList (a ).equalsElementwise (asList (b )));
746
- } else if ( a .isa (LIST ) ) {
747
- blockEvaluator .push (asList (a ).equalsElementwise (b ));
748
- } else if ( b .isa (LIST ) ) {
749
- blockEvaluator .push (asList (b ).equalsElementwise (a ));
750
- } else {
751
- throw new TypeError (this , a , b );
752
- }
748
+ final Obj a = blockEvaluator .pop ();
749
+ blockEvaluator .push (exec2arg (blockEvaluator .getContext (), a , b ));
753
750
}
754
751
752
+ @ Override
753
+ public Obj exec2arg (ExecutionContext context , final Obj a , final Obj b ) {
754
+ Obj res ;
755
+ // First apply standard vectorization rules
756
+ if ((res = VectorizedFunctions .vectorize2arg (context , this , a , b , NUML_OP )) != null ) return res ;
757
+ // Vectorization rules applied, return standard equals
758
+ return Num .fromBool (a .equiv (b ));
759
+ }
755
760
}
756
761
757
762
763
+
758
764
// ? - 63
759
765
class OP_Dot_Conditional extends Operator {
760
766
0 commit comments