f=: 13 :'<"0+:`-:`%/.y' 
   f 1 2 3
┌────────┐
│2       │
├────────┤
│1       │
├────────┤
│0.333333│
└────────┘
   f=: 13 :'<"0,+:`-:`%/.y' 
   f 1 2 3
┌─┬─┬────────┐
│2│1│0.333333│
└─┴─┴────────┘
   
Linda

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Thomas 
Costigliola
Sent: Wednesday, January 23, 2013 10:56 PM
To: J Programming Forum
Subject: Re: [Jprogramming] applying >1 gerunds to a set of items

Yet another way is to use apply, although there will be no implicit cyclic 
extension of the gerund...

   +:`-:`% 128!:2 each 1 2 3
┌─┬─┬────────┐
│2│1│0.333333│
└─┴─┴────────┘



On Wed, Jan 23, 2013 at 10:36 PM, Dan Bron <[email protected]> wrote:

> After the verb @ gerund behavior was decommissioned in J5, I wrote a 
> utility to emulate it. As a use case for the utility, I implemented an 
> adverb which lets you apply successive verbs (a gerund) to a 
> corresponding list of nouns.  The underlying mechanism is ;. (similar 
> to the /. approach Thomas outlined, but a little more flexible).
>
> More details here:  
> http://www.jsoftware.com/jwiki/DanBron/Snippets/DOOG . Caveat: I haven't 
> tested this with J7 - in fact, I haven't even run it in years.
>
> -Dan
>
> -----Original Message-----
> From: [email protected] [mailto:
> [email protected]] On Behalf Of bob therriault
> Sent: Wednesday, January 23, 2013 5:06 PM
> To: [email protected]
> Subject: Re: [Jprogramming] applying >1 gerunds to a set of items
>
> Thomas,
>
> Funny how you see what you want to see, when you think you have a 
> solution
> :)
>
> How about this:
>
>    <"0@|:@(+:`*:`%/.)  3 4 5
> +-+--+---+
> |6|16|0.2|
> +-+--+---+
>
> or if no boxing required:
>
>    |:@(+:`*:`%/.)  3 4 5
> 6 16 0.2
>
> I agree that it is not quite as clean as it used to be.
>
> Cheers, bob
>
> On 2013-01-23, at 1:29 PM, Thomas Costigliola wrote:
>
> > On Wed, Jan 23, 2013 at 4:05 PM, bob therriault 
> ><[email protected]
> >wrote:
> >
> >> Nice Thomas,
> >>
> >> I had not thought of oblique.
> >>
> >> You can still do this, although it is clunkier:
> >>
> >> <@(+:`*:`%/.) 3 4 5
> >> +---+
> >> |  6|
> >> | 16|
> >> |0.2|
> >> +---+
> >>
> >
> > I was hoping to box each row as you attempted below...
> >
> >
> >>   <@(+:`*:`%/."0) 3 4 5
> >> +-+-+--+
> >> |6|8|10|
> >> +-+-+--+
> >>
> >> or better,
> >>
> >> +:`*:`%/. each 3 4 5  NB. each  is &.>
> >> +-+-+--+
> >> |6|8|10|
> >> +-+-+--+
> >>
> >>
> >>
> > ... but these don't work correctly. If you look at the output it 
> > doesn't match your first example. +:`*:`%/. applies at rank zero, so 
> > each application applies the whole gerund to just one item, the 
> > result being only the first gerund gets executed each time.
> >
> > I have not found any elegant way to recreate the old way of 
> > distributing a verb across a gerund except by hand.
> >
> >   (+:e)`(*:e)`(%e)/. 1 2 3
> > ┌────────┐
> > │2       │
> > ├────────┤
> > │4       │
> > ├────────┤
> > │0.333333│
> > └────────┘
> >
> >
> > Cheers, bob
> >>
> >> On 2013-01-23, at 12:51 PM, Thomas Costigliola wrote:
> >>
> >>> <@(+:`*:`%)/. 3 4 5
> >>
> >> -------------------------------------------------------------------
> >> --
> >> - 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

Reply via email to