R.E. Boss,

Very fine, indeed.  The big learning opportunity for me was in your 
application of dyadic rank to an unadorned argument.  As you know (but 
other readers may not,) in the example of  2 chs 5  here's what happens:

   (]"0 _)&.>/ (i.5) ; i.4
+-------+
|0 1 2 3|
|0 1 2 3|
|0 1 2 3|
|0 1 2 3|
|0 1 2 3|
+-------+
   
It is great to see the compositional power of (]"0 _) demonstrated so.

Tracy


> I found a more efficient and much more elegant way:
> 
> chs=: 4 : ';(,/@:(([,. ]+ <:)"0 _) )&.>/ |.<@i."0 (>:y-x)+i.x'
> 
>    |: 2 chs 5
> 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4
> 1 2 3 4 0 2 3 4 0 1 3 4 0 1 2 4 0 1 2 3



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

Reply via email to