I'd call it random shape rather than random rank.  The rank is fixed at 3.


The sequence of steps I'm finding is

DATA =: 'ABCDEFFGHIJKLMNOPSSTUVXYZ'
SHAPE =: >: ? 3 # 5   NB. zeros aren't beneficial to this demonstration
A =: SHAPE $ DATA     NB. A is a rank 3 array of random shape
ITEM_RANK =: ? >: rank A
(;:'array items') , ( (< A) ; ( < <"ITEM_RANK A) ) , ( SHAPE ; ITEM_RANK )


Please remove this comment.  AD isn't defined, the comment doesn't alter D but looks like it does.

   NB.verb ra m]D=:3 4 5$AD


C isn't used again.  I wouldn't define it.


It looks as if D is intended to choose items of rank zero through the rank of B (which is 3).

Hence

   D =: ? >: # $ B      NB. (or just ? 4 )

   E =: <"D B


And then explain the table

"box all of B"  "Box rank D items of B"

Thanks!

Dave


On 09/23/2018 08:00 AM, [email protected] wrote:
Date: Sun, 23 Sep 2018 01:34:25 +0000
From: Linda Alvord<[email protected]>
To:"[email protected]"  <[email protected]>
Subject: Re: [Jprogramming] Using rank to avoid looping - reference?
Message-ID:
        
<bn6pr06mb3137f32fdcdaaaeb4a90313db5...@bn6pr06mb3137.namprd06.prod.outlook.com>
        
Content-Type: text/plain; charset="utf-8"

I made a little series of steps to illustrate the difeence between the two 
ranks. Did I get rthe differences right?

NB. Random rank noun B
    NB. and random rank verb b ox
A=:'ABCDEFFGHIJKLMNOPSSTUVXYZ'
    ]C=:<B=:(>:?3#5)$A
┌─┐
│A│

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

Reply via email to