Using your hints, I found these:

   f=: 13 :'y(,"1)1'
   f
1 ,"1~ ]
   g=: 13 :'((+/"1)f y)%#"1 f y'
   g
([: +/"1 f) % [: #"1 f
   g i.3 4
1.4 4.6 7.8

Do you think a novice would be able to understand these?

Linda


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ian Clark
Sent: Tuesday, July 24, 2012 3:12 AM
To: [email protected]
Subject: Re: [Jprogramming] fully parenthesized representation of a tacit
verb

> 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

Reply via email to