A noun has a rank and a verb has ranks! The ranks of a verb are always
integers or _ and are shown by the adverb b. . For example,
< b. 0
_ 0 0
means that < used monadically has rank _ and used diadically has left
rank 0 and right rank 0. The ranks are specified in the order m l r .
If you say a verb has rank 2 that is understood to mean its monadic,
left, and right ranks are 2 2 2 . If you say a verb has rank 2 3 that
is understood to mean its monadic, left and right ranks are 3 2 3 . And
if you say a verb has rank 1 2 3 that means its monadic, left and right
ranks are 1 2 3 ! The purpose of verb r below is to convert the short
form into the full form.
The 3 by 4 arrays in i. 2 3 4 are not ranks, but the numbers in their
upper left corners could be thought of as ranks, as could the numbers in
their lower right corners, or the numbers in any other specific
position. The result of r i. 2 3 4 correctly shows the corresponding
full forms.
(It is unusual for a finite verb rank to be more than 3, but there is no
theoretical limit! Old joke: it is unusual for a word to have more than
2 u's.)
Useful references:
Section 20. Rank in the Introduction part of the Dictionary
Sections II. A. Nouns and II. B. Verbs in the Dictionary proper.
On 11/23/2011 7:03 AM, Linda Alvord wrote:
> But are these ranks? This the same result that I get with the original
> expression you used?
>
> Linda
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Kip Murray
> Sent: Tuesday, November 22, 2011 11:28 PM
> To: Programming forum
> Subject: Re: [Jprogramming] 21 November ranks challenge in Simple J
>
> NB. Explain behavior of
>
> r =: [: |. 3 $ |.
>
> NB. Compare steps for r 0 1 with steps for r i. 2 3 4 .
>
> NB. First
>
> r 0 1
> 1 0 1
>
> NB. What happens is
>
> |. 0 1 NB. Reverse 0 1
> 1 0
> 3 $ 1 0 NB. Select from 1 0 1 0 1 0 ... until 3 have been chosen
> 1 0 1
> |: 1 0 1 NB. Reverse 1 0 1
> 1 0 1
>
> NB. Now look at
>
> i. 2 3 4 NB. Items are two 3 by 4 arrays, think array0 and array1
> 0 1 2 3
> 4 5 6 7
> 8 9 10 11
>
> 12 13 14 15
> 16 17 18 19
> 20 21 22 23
>
> NB. When we do r i. 2 3 4 what happens is
>
> |. i. 2 3 4 NB. Reverse the two arrays
> 12 13 14 15
> 16 17 18 19
> 20 21 22 23
>
> 0 1 2 3
> 4 5 6 7
> 8 9 10 11
> 3 $ |. i. 2 3 4 NB. Select 3 from array1 array 0 array 1 array 0 ...
> 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
> |. 3 $ |. i. 2 3 4 NB. reverse the selected arrays
> 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
>
> NB. Thus,
>
> 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
>
>
> On 11/22/2011 8:54 PM, Linda Alvord wrote:
>> 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
> ----------------------------------------------------------------------
> 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