From 8bb1d276a8387d18cbec3ae809cdd29ad0046da4 Mon Sep 17 00:00:00 2001 From: Li-Xiang-Ideal <54926635+Li-Xiang-Ideal@users.noreply.github.com> Date: Tue, 12 Dec 2023 21:53:14 +0800 Subject: [PATCH] Fix_ArrayQ --- mathics/builtin/testing_expressions/list_oriented.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mathics/builtin/testing_expressions/list_oriented.py b/mathics/builtin/testing_expressions/list_oriented.py index cd643d618..1f7480690 100644 --- a/mathics/builtin/testing_expressions/list_oriented.py +++ b/mathics/builtin/testing_expressions/list_oriented.py @@ -39,14 +39,14 @@ class ArrayQ(Builtin): = False >> ArrayQ[{{a, b}, {c, d}}, 2, SymbolQ] = True + + ArrayQ works on sparse arrays: >> ArrayQ[SparseArray[{{1, 2} -> a, {2, 1} -> b}]] = True - >> ArrayQ[SparseArray[{{1, 2} -> a, {2, 1} -> b}], 1] - = False + + For sparse arrays, ArrayQ tests not only specified values, but also default value 0: >> ArrayQ[SparseArray[{{1, 2} -> a, {2, 1} -> b}], 2, SymbolQ] = False - >> ArrayQ[SparseArray[{{1, 1} -> a, {1, 2} -> b}], 2, SymbolQ] - = True """ rules = {