On Sun, May 6, 2012 at 10:20 PM, Linda Alvord <lindaalv...@verizon.net> wrote:
> I found it confusing ...

Here's my perspective, I hope it helps.

First, when dealing with shapes, I always like to start by working with i.

   $ i. 1 2 3 4
1 2 3 4
   $ i. ''

In general, $ will give you back something which is a suitable
argument for i. which in turn will give you an array with the same
shape.

And, # can be defined in terms of $

hash=: '' $ $ , 1:

Here, hash produces the same monadic result as #

   (# -: hash) ''
1
   (# -: hash) i. 2 3 4
1
   (# -: hash) i. 1 2 3 4
1

Finally,

rank=: #@$

or

rank=: '' $ [: $ $

Note that we do not need a 1: here because the monadic result of $ is
always a list.

FYI,

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to