33
44from mathics .version import __version__ # noqa used in loading to check consistency.
55
6- import itertools
76from typing import Optional , Union
87
98import sympy
@@ -218,6 +217,7 @@ class _EqualityOperator(_InequalityOperator):
218217 "Compares all pairs e.g. a == b == c compares a == b, b == c, and a == c."
219218
220219 def do_compare (self , l1 , l2 ) -> Union [bool , None ]:
220+ print ("do_compare:" , (l1 ,l2 ))
221221 if l1 .same (l2 ):
222222 return True
223223 elif l1 == SymbolTrue and l2 == SymbolFalse :
@@ -279,7 +279,9 @@ def apply(self, items, evaluation):
279279 return self .apply_other (items , evaluation )
280280 args = self .numerify_args (items , evaluation )
281281 wanted = operators [self .get_name ()]
282- for x , y in itertools .combinations (args , 2 ):
282+ pairs = zip (args [:- 1 ],args [1 :])
283+ print ("apply:" , args )
284+ for x , y in pairs :
283285 if isinstance (x , String ) or isinstance (y , String ):
284286 if not (isinstance (x , String ) and isinstance (y , String )):
285287 c = 1
@@ -297,7 +299,9 @@ def apply(self, items, evaluation):
297299 def apply_other (self , args , evaluation ):
298300 "%(name)s[args___?(!ExactNumberQ[#]&)]"
299301 args = args .get_sequence ()
300- for x , y in itertools .combinations (args , 2 ):
302+ pairs = zip (args [:- 1 ],args [1 :])
303+ print ("apply_other:" , args )
304+ for x , y in pairs :
301305 c = self .do_compare (x , y )
302306 if c is None :
303307 return
0 commit comments