--- Terrence Brannon <[EMAIL PROTECTED]> wrote: > < quote href = http://www.jsoftware.com/help/jforc/declarations.htm > > The result of dyad $ has the frame x relative to the rank of the items of y, > and is made up of the items of y, repeated cyclically as needed. It follows > that the shape of this result is x concatenated with the shape of an item of > y . > < / quote > > > 1 - I dont understand "relative to the rank of the items of y" How is frame > (shape) relative to the rank of an array?
This careful wording is in the style of Dictionary: correct but not immediately intuitive. A clarification may be needed. If y is an array of rank N then it's item-cells are of rank N-1, when viewed as a list, i.e. with rank-1 frame. Rank-N array is rank-1 list of rank(N-1) cells. What dyad $ is doing, it takes the shape of the rank(N-1) items (discarding the length of the leading dimension forming the list), and appends it to vectors* of x. If x is rank 1 or 0, then shape of $ result is x,}.$y. That's how shape is determined. In construction, the resulting rank(N-1) cells are fit into the x frame the same scalars (atoms) are fit into x of $. Note positions of 0s here: 2 3 $ i.4 3 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 2 3 $ 0 1 2 3 0 1 2 3 0 1 _______ * in general, because dyad $ is rank 1 for x, i.e. item-wise rank expansion takes place for higher rank x. $(3 4,:5 6)$i.2 3 NB. shape is (}:$x),(>./^:([EMAIL PROTECTED])x),}.$y 2 5 6 3 (3 4,:5 6) (}:@[EMAIL PROTECTED] , >./^:([EMAIL PROTECTED])@[ , [EMAIL PROTECTED]@]) i.2 3 2 5 6 3 <"2 (3 4,:5 6)$i.2 3 +-----+-----+-----+-----+-----+ << (3 4,3)$ |0 1 2|0 1 2|0 1 2|0 0 0|0 0 0| |3 4 5|3 4 5|3 4 5|0 0 0|0 0 0| |0 1 2|0 1 2|0 1 2|0 0 0|0 0 0| |3 4 5|3 4 5|3 4 5|0 0 0|0 0 0| |0 0 0|0 0 0|0 0 0|0 0 0|0 0 0| |0 0 0|0 0 0|0 0 0|0 0 0|0 0 0| +-----+-----+-----+-----+-----+ << (5 6,3)$ |0 1 2|0 1 2|0 1 2|0 1 2|0 1 2| |3 4 5|3 4 5|3 4 5|3 4 5|3 4 5| |0 1 2|0 1 2|0 1 2|0 1 2|0 1 2| |3 4 5|3 4 5|3 4 5|3 4 5|3 4 5| |0 1 2|0 1 2|0 1 2|0 1 2|0 1 2| |3 4 5|3 4 5|3 4 5|3 4 5|3 4 5| +-----+-----+-----+-----+-----+ (i.2 3 4) (}:@[EMAIL PROTECTED] , >./^:([EMAIL PROTECTED])@[ , [EMAIL PROTECTED]@]) i.2 3 2 3 20 21 22 23 3 $ (i.2 3 4) $ i.2 3 2 3 20 21 22 23 3 > 2 - x concatenated with the shape of an item of y cannot work when x is an > empty list. The author gives this example: > > <example> > (0 $ 2) $ 2 > > 2 > > Here (0 $ 2) produces an empty list, as we saw above, and that is the x to > the second $ . The items of y are still scalars, so the result has shape > empty (an empty list concatenated with an empty list), i. e. it is a scalar. > > </example> > > but (0 $ 2) produces an empty list. So using our understanding of what x $ y > does (the shape of this result is x concatenated with the shape of an item > of y .) , we can see that we cannot concatenate x in this case because it is > not a shape but an empty list. Shape is not just a list, it's always a vector (rank 1). And it can perfectly be empty, i.e. length 0. It simply means that the object is not an array, but an atom. These are equivalent and work for non-empty y. ''$ i.3 4 2 0 1 2 3 4 5 6 7 (($,)~ [EMAIL PROTECTED]) i.3 4 2 0 1 2 3 4 5 6 7 What is the corresponding primitive? Answer at http://www.jsoftware.com/jwiki/PrimitivePrimitives ____________________________________________________________________________________ Never miss an email again! Yahoo! Toolbar alerts you the instant new Mail arrives. http://tools.search.yahoo.com/toolbar/features/mail/ ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
