The resultant shape of rank follows the rule:
Result_shape =: (Frame_Shape),(Resultant_cell_shape)
With {."1 of a 2 3 4 array, this means the frame shape is (2 3) and the
result cell shape is empty or ¹ since {. of a vector produces a scalar,
which has empty shape, or ''.
Hence Result_Shape is (2 3),('') which is (2 3) and displays as a 2x3 array.
Consider f²K i.2 3 4 5 then:
For K ... k-cell frame k-cell shape Comment
0 2 3 4 5 '' (empty ? 2x3x4x5
shaped group of scalars (singletons)
1 2 3 4 5 2x3x4
array of 5 element vectors
2 2 3 4 5 2x3
table of 4x5 tables
3 2 3 4 5 2 lots
of 3 4 5 arrays
4 '' (empty) 2 3 4 5 a singleton
2x3x4x5 array
And for -ve k ...
_1 2 3 4 5 2 lots of
3 4 5 arrays
_2 2 3 4 5 2x3 table
of 4x5 tables
_3 2 3 4 5 2x3x4
array of 5 element vectors
_4 2 3 4 5 '' (empty ?)
In the above table remember that {. Is then applied to each k-cell shape,
and {. reduces the rank by 1 (ie {. on a list is a scalar, and {. on a table
is a list).
.../Rob
On 9/8/07 4:25 AM, "Kip Murray" <[EMAIL PROTECTED]> wrote:
> I am trying to understand Chapter 3 Rank of Verbs in Henry's lab An
> Introductory Course in J. Here one of his examples:
>
> ] array =: 2 3 4 $ 'abcdefghijklmnopqrstuvwx'
> abcd
> efgh
> ijkl
>
> mnop
> qrst
> uvwx
> {."1 array NB. Select first item of each 1-cell
> aei
> mqu
>
> Why isn't the result displayed as
>
> a
> e
> i
>
> m
> q
> u
>
> ?
>
> The answer is that J always displays vectors horizontally, other arrays
> vertically. An impractical but consistent display is provided by
>
> showlist =: [: ": ,."1
>
> which displays all arrays vertically:
>
> showlist array
> a
> b
> c
> d
>
> e
> f
> g
> h
>
> i
> j
> k
> l
>
>
> m
> n
> o
> p
>
> q
> r
> s
> t
>
> u
> v
> w
> x
>
> The array is a list of two tables, each a list of three vectors (here
> displayed vertically), each a list of four letters.
>
> showlist {."1 array
> a
> e
> i
>
> m
> q
> u
>
> The result is a list of two vectors (here displayed vertically), each a
> list of three letters. In the standard display, the vectors are
> horizontal:
>
> {."1 array
> aei
> mqu
>
> By consistently showing lists vertically, verb showlist helps me
> understand examples in Henry's Chapter 3.
>
> Kip Murray
>
> [EMAIL PROTECTED]
> http://www.math.uh.edu/~km
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm