One possibility,

  ranks=: 3$(2=#)|.]

Note that behaviour differs for lists of length > 3:

   ranks 2
2 2 2
   ranks 2 3
3 2 3
   ranks 2 3 4
2 3 4

   ranks 2 3 4 5  NB. kip's returns 3 4 5
2 3 4

but since this is (presumably) an illicit input, I gather that the
above meets the requirements?

Best,
M

On Mon, Nov 21, 2011 at 11:39 AM, Kip Murray <[email protected]> wrote:
> 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