> That said, your foox works, but in other cases that kind of rephrasing
> would cause problems.  So I consider it misleading.  ...

On reflection I have to agree.

It's hard enough to explicate the flow of nouns between individual
verbs in a tacit expression, without the extra layer of obscurity
caused by the use of Rank ("1) in connection with (@), which needs me
to explicate (somehow) the flow of individual frames of those nouns.
Comparable problems arise with (^:).

My original foox hinted to the novice that ("1) is somehow distributed
over the individual primitives of (+/ % #) (aka: "mean") whereas in
truth the rank of "mean" is not altered from its original (_ _ _).
But, according to my experiments, "mean" only ever gets called with
individual rows of ((,&1)"1) y.

The trouble is, deducing the rank of u@v knowing the ranks of the
verbs u and v is not easy to explicate (if at all) by passing a single
intermediate noun (z) from v to u. My solution was a fudge. I guess
foo is best explained -- and understood -- by assigning intermediate
verbs instead of nouns. (Or: as well as nouns.) I guess Linda is
making the same point.

So here's a clearer explication, and hopefully a more accurate one:

foo_explicated=: 3 : 0
        NB. ((+/) % #) @ ((,&1)"1)
u=: 3 : '(+/ y) % (# y)'        NB. [rank: _ _ _]   (+/) % #
v=: (3 : 'y , 1')"1             NB. [rank: 1 1 1]   (,&1)"1
w=: u@v                         NB. [rank: 1 1 1]   ((+/) % #) @ ((,&1)"1)
w y
)

   foo_explicated i. 3 4
1.4 4.6 7.8

It keeps tacit code to the bare minimum needed to clarify the Rank
behaviour under (@). The ranks of u v w can be found using (b.) in
order to generate the explanatory comments.


On Tue, Jul 24, 2012 at 2:15 PM, Raul Miller <[email protected]> wrote:
> Rank does have several meanings.
>
> Have you read this writeup?
> http://en.wikipedia.org/wiki/Rank_(J_programming_language)
>
> (from back in the day when wikipedia did not have a teams of people
> actively removing new content.)
>
> That said, your foox works, but in other cases that kind of rephrasing
> would cause problems.  So I consider it misleading.  Consider, for
> example:
>
>   (+/ ; i.)@(,&1"1) i. 2 2
>
>
> vs
>
>    z=: ((i. 2 2) (,"1) 1)
>    (+/"1 z) ;"1 (i."1 z)
>
> (So perhaps I should just ignore everything other than hooks and
> forks, for now...?)
>
> --
> Raul
>
> On Tue, Jul 24, 2012 at 3:11 AM, Ian Clark <[email protected]> wrote:
>>> Consider, for example:
>>>   (+/%#)@(,&1"1) i. 3 4
>>>
>>> If we eliminate the noun, and try to explain the verb, what would you
>>> want to see here?
>>
>> The short answer is: whatever would be clearest for the J novice.
>>
>> Let's call your example foo and show it under 5!:6 (and slightly more
>> spaced) ...
>>
>>    foo=: ((+/) % #) @ ((,&1)"1)
>>    foo i.3 4
>> 1.4 4.6 7.8
>>
>> Since I don't understand Rank (") as fully as I'd like, I really can't
>> say what would be clearest in this case. But I don't now think an
>> explicit one-liner would be at all clear, even if I could think how to
>> generate it. I'm already puzzling over how to "explicate" verb
>> phrases: u@v  u@:v  u&v .
>>
>> I find Ambrus's approach with tte.ijs the most appealing:  @  @: &
>> themselves disappearing in a multi-stage expansion. The existing "tte"
>> refuses to break down this example. But I'd hope for something like
>> this...
>>
>> foox=: 3 : 0
>>         NB. ((+/) % #) @ ((,&1)"1)
>> z=. (y (,"1) 1)                 NB. ((,&1)"1)
>> (+/"1 z) %"1 (#"1 z)            NB. ((+/) % #) @ ...
>> )
>>
>>    foox i.3 4
>> 1.4 4.6 7.8
>>
>>
>> On Mon, Jul 23, 2012 at 4:23 PM, Raul Miller <[email protected]> wrote:
>>> On Fri, Jul 20, 2012 at 11:45 PM, Ian Clark <[email protected]> wrote:
>>>> To take an example for the benefit of pragmatists trying to follow
>>>> this thread, I'm not asking for a whole BNF grammar but a simple
>>>> pragmatic set of transformation rules to convert, say:
>>>>    4 : 'x (a b c d) y'
>>>> into, say:
>>>>    4 : 'x a ((b y) c (d y))'
>>>> which I loosely called "multiplying out".
>>>
>>> If I were attempting this, I think I would start with atomic
>>> representation (5!:1 instead of 5!:6).
>>>
>>> In the context of 5!:1 I would look for lists whose first elements
>>> were <,'3' (second element of the list contains 3 atomic
>>> representations which are combined in a fork) and whose first elements
>>> were <,'2' (second element of the list contains 2 atomic
>>> representations which are combined in a hook).
>>>
>>> I think I would also be providing both monadic and dyadic definitions
>>> (keeping in mind that hooks and forks sometimes constrain the context
>>> for contained verbs.  For example, the first verb in a hook is always
>>> used dyadically and the second verb is always used monadically.
>>>
>>> But note that there are cases which present themselves here which
>>> deserve some thought.
>>>
>>> Consider, for example:
>>>
>>>   (+/%#)@(,&1"1) i. 3 4
>>>
>>> If we eliminate the noun, and try to explain the verb, what would you
>>> want to see here?
>>>
>>> Thanks,
>>>
>>> --
>>> Raul
>>> ----------------------------------------------------------------------
>>> 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

Reply via email to