bill lam wrote: |I guess the word stitch already well chosen to explain its intent. |It is impossible to stitch a handkerchief of 4 inch square with |another of 5 inch square. However if they have prefix agreement, |it is possible to stitch them together.
Yes, I'm aware that "stitch" CAN join data under certain conditions. What I was wondering is why "stitch" doesn't act like "append" and "laminate" by adding a 1-inch strip to your 4-inch handkerchief example above and then doing the stitch? Here are some sample data to show what I mean: [The zeros below are the automatic fills done by J when processing the primitives.] ]tbl=: 3 3 $ 4 5 6 14 15 16 3 2 1 4 5 6 14 15 16 3 2 1 ]tbl2=. 2 2 $ 4 3 2 1 4 3 2 1 ]lst=: 5 6 7 8 9 5 6 7 8 9 tbl,tbl2 NB. "append" two tables of differing sizes 4 5 6 14 15 16 3 2 1 4 3 0 2 1 0 tbl,lst NB. "append" table and list of differing sizes 4 5 6 0 0 14 15 16 0 0 3 2 1 0 0 5 6 7 8 9 tbl,:tbl2 NB. "laminate" two tables of differing sizes 4 5 6 14 15 16 3 2 1 4 3 0 2 1 0 0 0 0 tbl,:lst NB. "laminate" table and list of differing sizes 4 5 6 0 0 14 15 16 0 0 3 2 1 0 0 5 6 7 8 9 0 0 0 0 0 0 0 0 0 0 tbl,.tbl2 NB. attempt to "stitch" two tables of differing sizes |length error | tbl ,.tbl2 tbl,.lst NB. attempt to "stitch" table and list of differing sizes |length error | tbl ,.lst You see, I was just curious why stitch doesn't automatically operate like this (to parallel the "append" and "laminate" primitives), rather than throwing an error: tbl,.tbl2 NB. "stitch" two tables of differing sizes [imagined] 4 5 6 4 3 14 15 16 2 1 3 2 1 0 0 tbl,.lst NB. "stitch" table and list of differing sizes [imagined] 4 5 6 5 14 15 16 6 3 2 1 7 0 0 0 8 0 0 0 9 If there are deliberate reasons for the current size matching restriction over against no such restrictions for "append" and "laminate", I would like to know what they are so that I can better understand the language and how it works. I'm NOT asking to change the language by any means! I'm just trying to find out the "why" of this. In other words, "append" and "laminate" can join data under ALL conditions (by filling out arrays), but stitch only works under SOME conditions. I was merely wondering why "stitch" was restricted and "append" and "laminate" were not? I don't have the general APL/array experiential background most people here have, and I was wondering if there's some common circumstance or whatever that led to this apparently deliberate difference between these primitives. In other words, is there something that "stitch" is commonly used for that requires exact size matching rather than filling in? Any further insights from anyone would be appreciated. Thanks! Harvey ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
