Not as simple as I would like, but simple enough I hope:
G =:0 1 2 2 3 4 4 5 5 6 7 7 8 9 10 10 11 11 11 12 12 12 G =: G ,. 1 2 3 4 5 6 5 7 8 7 9 10 10 11 12 11 13 14 15 16 15 14 G =: <"1 G joinroutes =: 4 : 0&.> l =. >: (y i. {: x) f =. 0:^:((#y)&=) (y i. {. x) z =. (f {. y) , x , (l }. y) NB. this is the culprit --> y E. z y ) jtree =: ([: ~.@; joinroutes)/ If I uncomment the indicated line, I get a loop. That implicates numeric dyad E. . Henry Rich On 4/25/2012 9:54 PM, Joey K Tuttle wrote: > Henry, > > I get different errors from different versions of j (e.g. 32 vs 64 bit > J7) and, in j602/Linux a Segmentation fault - but corrupted versions of > G I haven't seen... Did you derive a simpler demonstration of the problem? > > On 2012/04/25 13:51 , Henry Rich wrote: >> I have tracked this down to numeric dyad E. which seems to cause wild >> stores to memory, sometimes wiping out data, sometimes scripts. >> >> In our new open-source environment, how do bugs get fixed and released? >> >> Henry Rich >> >> On 4/24/2012 9:52 PM, Henry Rich wrote: >>> Working on R. E.'s latest problem, I hit an interpreter bug. The >>> session log is >>> >>> load 'C:\JPrograms\temp\interpbug.ijs' >>> jtree G >>> |domain error: jtree >>> | jtree G >>> X >>> 10 12 >>> Y >>> 12 15 >>> (<10 12) joinroutes (<12 15) >>> ┌──────────┐ >>> │┌────────┐│ >>> ││10 12 15││ >>> │└────────┘│ >>> └──────────┘ >>> jtree G >>> |domain error: joinroutes >>> | y(+./@:E.}.;)(1{.y) ,x,(l}.y) >>> jtree G >>> |length error: joinroutes >>> | 'f l'=.0 1+(0 1+#y) |y i.x >>> G >>> +---+-+---+---+---+---+--+---+---+---+---+----+----+----+-----+-----+-----+-----+-----+-----+-----+-----+ >>> |0 1||2 3|2 4|3 5|4 6| |5 7|5 8|6 7|7 9|7 10|8 10|9 11|10 12|10 11|11 >>> 13|11 14|11 15|12 16|12 15|12 14| >>> +---+-+---+---+---+---+--+---+---+---+---+----+----+----+-----+-----+-----+-----+-----+-----+-----+-----+ >>> >>> You can see that the variable G has been corrupted; also, the errors >>> running jtree are bogus, I think. The script file follows. The first >>> line is wrapped, and the name 'joinroutes' is defined and then overwritten: >>> >>> G =:<"1 ] 0 1 2 2 3 4 4 5 5 6 7 7 8 9 10 10 11 11 11 12 12 12 ,. 1 2 3 >>> 4 5 6 5 7 8 7 9 10 10 11 12 11 13 14 15 16 15 14 >>> NB. x is new pair >>> NB. y is old route >>> NB. Result is merged routes >>> joinroutes =: 4 : 0&.> >>> select. (#y)> 'f l' =. y i. x >>> case. 1 1 do. >>> y ; (f {. y) , x , ((>:l) }. y) >>> case. 0 1 do. >>> y ;^:(l~:0)< x , ((>:l) }. y) >>> case. 1 0 do. >>> y ;^:(f~:<:#y)< (f {. y) , x >>> case. do. >>> y ; x >>> end. >>> ) >>> joinroutes =: 4 : 0&.> >>> X =: x >>> Y =: y >>> >>> 'f l' =. 0 1 + (0 1 + #y) | y i. x >>> y (+./@:E. }. ;) (f {. y) , x , (l }. y) >>> ) >>> jtree =: ([: ~.@; joinroutes)/ > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm