bug in J9.6 ? MasterSet i. ~. SubSet

27 views
Skip to first unread message

John-Philip Butler

unread,
Jul 15, 2025, 1:23:34 PM7/15/25
to forum
I have encountered strange behaviour:

   ParentIdxAll

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ... 345 346

   ParentIndex

1 3 4 5 11 31 32 33 63 65 68 98 112 113 114 154 155 156 ... 329 330

   ParentIdxAll i. ~. ParentIndex             NB. Unexpected result!

346 346 346 346 346 346 346 346 346 346 346 346 ... 346

   ParentIdxAll i. ParentIndex                  NB. behaves as expected

0 2 3 4 10 30 31 32 62 64 67 97 111 112 113 153 154 155 ... 328 329

   NB. Workaround

   ParentIndexUnique =. ~. ParentIndex

   ParentIdxAll i. ParentIndexUnique       NB. gives desired proper result

0 2 3 4 10 30 31 32 62 64 67 97 111 112 113 153 154 155 ...328 329


The calling code is a bit convoluted, and is inside an object, so it is not easy to reproduce:

NB.*invertParents v build a table for immediately finding the children of a node
NB.-syntax:
NB.-   invertParents__Data childTable
NB.-note:
NB.-Result is parent table name ; boxed matrix of children, in same order as the index of the parent table
invertParents=: 3 : 0
ChildTable=.y
'Index ParentTable ParentIndex'=.(< 3 4 5 ; 1) { ('Metadata_',ChildTable)~
ParentTable =. unslashTableName ParentTable
ParentIdxAll=. 3 1 {::  ('Metadata_',ParentTable)~
PClas=.ParentIndex </. Index
Res=.(# ParentIdxAll) # a:
Res=. PClas (ParentIdxAll i. ~. ParentIndex) } Res
ParentTable ; < Res
)

Unfortunately i do not have a strict unittest for this verb. It works on some datasets but not all.  I suspect that this has something to do with unaliasing and indirect names that make i. ~. behave like (i. ~.) ?

Henry Rich

unread,
Jul 15, 2025, 1:40:15 PM7/15/25
to fo...@jsoftware.com
There is no special code for pairs of verbs that are not connected by a modifier.

Can you give me a way to reproduce this?  Either the values of ParentIdxAll and ParentIndex that cause the failure, or the y argument to InvertParents, perhaps in a file.

It looks like ~. is giving a wrong result.

Henry Rich


To unsubscribe from this group and stop receiving emails from it, send an email to forum+un...@jsoftware.com.

Reply all
Reply to author
Forward
0 new messages