NB. ({:"1 A) equals {."1 B so not the leading column of A Perhaps I should have added that ({:"1 A) =&~. {."1 B or all not matching rows are deleted.
R.E. Boss > -----Oorspronkelijk bericht----- > Van: programming-boun...@forums.jsoftware.com > [mailto:programming-boun...@forums.jsoftware.com] Namens Raul Miller > Verzonden: maandag 15 oktober 2012 18:24 > Aan: programm...@jsoftware.com > Onderwerp: Re: [Jprogramming] stitching matrices > > Given your description, I would have expected a result like this: > > 0 1 2 0 1 1 2 0 > 0 1 2 0 1 1 2 0 > 2 0 1 2 0 0 1 2 > 1 2 0 1 2 2 0 1 > 1 2 0 1 2 2 0 1 > > I do not understand the result you proposed. > > Also, you have not specified what happens for rows where the leading > column of A has a value which does not appear in the leading column of > B. I can imagine several treatments for this case: > > 1) error > 2) join to a row of fills > 3) eliminate the row from the result > > Likewise for the reverse case, where the leading column of B has a > value which does not appear in the leading column of A. (And, the > asymmetric treatment of A and B, where one of the columns of B does > not contribute to the result, makes me wonder if the treatment for > {."1 A not in {."1 B might be different from from the treatment of > {."1 B not in {."1 A.) > > So... I am confused. Any clarification or explanation you can provide > could help. > > Thanks, > > -- > Raul > > On Mon, Oct 15, 2012 at 10:59 AM, R.E. Boss <r.e.b...@planet.nl> wrote: > > Given > > > > ['A B' =. 3|L:0<@i."(1)3 5,: 5 4 > > +---------+-------+ > > |0 1 2 0 1|0 1 2 0| > > |2 0 1 2 0|1 2 0 1| > > |1 2 0 1 2|2 0 1 2| > > | |0 1 2 0| > > | |1 2 0 1| > > +---------+-------+ > > > > I want to stitch every row from A with all rows from B where ({:"1 A) > > equals {."1 B and one of these columns is deleted. > > This will give me > > > > A foo B > > 0 1 2 0 1 2 0 1 > > 0 1 2 0 1 2 0 1 > > 2 0 1 2 0 1 2 0 > > 2 0 1 2 0 1 2 0 > > 1 2 0 1 2 0 1 2 > > > > Any elegant solutions? > > > > > > R.E. Boss > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm