$ Shape Of - Shape

>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help Dictionary

Shape Of | $ _ 1 _ | Shape

`$ y` yields the shape of`y` as defined in Section II A. For example, the shape of a 2-by-3 matrix is`2 3`,`` and the shape of the scalar`3` is an empty list (whose shape is`0`).`` The rank of an argument`y` is`#@$ y` .`` For example:
       rank=: #@$
       (rank 3) , (rank ,3)
    0 1

       (rank 3 4),(rank i. 2 3 4)
    1 3
|  | The shape of`x$y` is`x,siy` where`siy` is the shape of an item of`y`;`x$y` gives a length error if`y` is empty and`x,siy` does not contain a zero. For example:
       y=: 3 4$'abcdefghijkl'
       y ; 2 2$ y
    +----+----+
    |abcd|abcd|
    |efgh|efgh|
    |ijkl|    |
    |    |ijkl|
    |    |abcd|
    +----+----+
This example shows how the result is formed from the items of`y`,`` the last 1-cell`` (`abcd`)`` showing that the selection is cyclic. The fit conjunction`` (`$!.f`)`` provides fill specified by the items of`f` .

Since`x $ y` uses items from`y`,`` it is sometimes useful to ravel the right argument, as in`x $ ,y`.`` For example (using the`y` defined above):

       2 3 $ ,y
    abc
    def

The fit conjunction is often useful for appending zeros or spaces. For example:

       8 $!.0 (2 3 4)
    2 3 4 0 0 0 0 0

       ]z=: 8$!.'*' 'abc'
    abc*****

       |. z
    *****cba

       2 5$!.a: ;: 'zero one two three four five six'
    +----+---+---+-----+----+
    |zero|one|two|three|four|
    +----+---+---+-----+----+
    |five|six|   |     |    |
    +----+---+---+-----+----+

>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help Dictionary