Here's a simple translation, but both it and the original have the same
peculiarities.

   ranks =: 3 : '3$&.|.y'
   ranks
3 : '3$&.|.y'

   ranks2 =: 13 : '3$&.|.y'
   ranks2
3 $&.|. ]

   r=: 13 :'|.(|. 3) $|.y'
   r
[: |. 3 $ |.

    5!:4 <'ranks'
      -- 3          
- : -+- ,:'3$&.|.y'

   5!:4 <'ranks2'
  -- 3        
  │      -- $ 
--+- &. -+- |.
  L- ]        

   5!:4 <'r'
  -- [:     
  +- |.     
--+    -- 3 
  L----+- $ 
       L- |.

   ranks 2
2 2 2
   ranks 2 3
3 2 3
  ranks i.2 3 4
12 13 14 15
16 17 18 19
20 21 22 23

 0  1  2  3
 4  5  6  7
 8  9 10 11

12 13 14 15
16 17 18 19
20 21 22 23

   

  r 2
2 2 2
  r 2 3
3 2 3
   r i.2 3 4
12 13 14 15
16 17 18 19
20 21 22 23

 0  1  2  3
 4  5  6  7
 8  9 10 11

12 13 14 15
16 17 18 19
20 21 22 23

I have't followed some of the later ways to find rank.  My question is what
happened here. It seemed like a simple J expression.

Thanks 

Linda

   

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Kip Murray
Sent: Monday, November 21, 2011 6:40 AM
To: Programming forum
Subject: Re: [Jprogramming] 21 November ranks challenge in Simple J

It is 21 November, solutions are welcome.

On 11/18/2011 11:33 AM, Kip Murray wrote:
> Please wait until Monday 21 November to post solutions.
>
>   From the Rank u"n page in the Vocabulary:
>
> The verb u"n applies u to each cell as specified by the rank n . The
> full form of the rank used is 3$&.|.n . For example, if n=:2 , the three
> ranks are 2 2 2 , and if n=: 2 3, they are 3 2 3 .
>
> The challenge: rewrite verb
>
>      ranks =: 3 : '3$&.|.y'
>
> using a train with no conjunctions.
>
>      ranks 2
> 2 2 2
>      ranks 2 3
> 3 2 3
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

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

Reply via email to