I should have added, Thanks for the report!

Henry Rich

On 10/28/2020 4:54 AM, Jan-Pieter Jacobs wrote:
Hi,

I just found a bug I'd like to report in the execution of special code
relating to the number of items in sparse arrays. Apparently only the
non-sparse elements are reported when a special combination */@$ or #@, is
detected, rather than the total number of elements:

    a=: $. (* 3>]) 10 10?@$ 10
    a
0 2 │ 1
0 5 │ 1
0 8 │ 2
1 3 │ 2
1 6 │ 2
1 8 │ 1
1 9 │ 1
2 0 │ 1
2 2 │ 2
2 3 │ 1
3 0 │ 2
3 3 │ 1
3 6 │ 1
4 1 │ 1
4 4 │ 2
5 5 │ 1
5 6 │ 1
6 1 │ 2
6 4 │ 1
6 8 │ 1
7 2 │ 1
8 0 │ 2
8 2 │ 2
9 5 │ 1

    ('expected';'wrong'),((*/ $ a); (*/@$ a)),:(# ,a);(#@,a)
+--------+-----+
|expected|wrong|
+--------+-----+
|100     |20   |
+--------+-----+
|100     |20   |
+--------+-----+
       '`shape count'=:$`#

    (*/@shape ; count@,) a NB. these do work
+---+---+
|100|100|
+---+---+


Apparently this is both in j901 and 902, so it is not a beta-only problem.


Best regards,

Jan-Pieter
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


--
This email has been checked for viruses by AVG.
https://www.avg.com

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to