Skip to content

Commit

Permalink
Fix ArrayQ
Browse files Browse the repository at this point in the history
  • Loading branch information
Li-Xiang-Ideal committed Dec 12, 2023
1 parent 28b4ba1 commit ff1d13f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions mathics/builtin/testing_expressions/list_oriented.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ class ArrayQ(Builtin):
= True
>> ArrayQ[SparseArray[{{1, 2} -> a, {2, 1} -> b}], 1]
= False
>> ArrayQ[SparseArray[{{1, 2} -> a, {2, 1} -> b}], 2, NumericQ]
= False
>> ArrayQ[SparseArray[{{1, 2} -> a, {2, 1} -> b}], 2, SymbolQ]
= False
>> ArrayQ[SparseArray[{{1, 1} -> a, {1, 2} -> b}], 2, SymbolQ]
= True
"""

Expand Down
4 changes: 2 additions & 2 deletions mathics/eval/testing_expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ def check_SparseArrayQ(expr, pattern, test, evaluation: Evaluation):
if array_size.value > len(rules.elements): # expr is not full
test_expr = Expression(test, default_value) # test default value
if test_expr.evaluate(evaluation) != SymbolTrue:
return False
return SymbolFalse
for rule in rules.elements:
test_expr = Expression(test, rule.elements[-1])
if test_expr.evaluate(evaluation) != SymbolTrue:
return False
return SymbolFalse

return SymbolTrue

0 comments on commit ff1d13f

Please sign in to comment.