Another option
load 'misc/miscutils/utils'
+:`-:`^ respectively] 3 1 0
6 0.5 1
NB. or if the results of each cell are different shapes ...
+:`-:`^ respectively> 3 1 0
+-+---+-+
|6|0.5|1|
+-+---+-+
The spec for the conjunction respectively as given in the script:
NB. u is gerund, v is a verb. [x] (k{u)`:0 &. v is applied to cell k of y
NB. The first cell is evaluated to get the shape of a cell, then all cells
are reevaluated
On Fri, May 3, 2019 at 4:32 PM Gilles Kirouac <[email protected]> wrote:
> or (not as simple)
>
> c=: (128!:2)&.><
>
> g c"0 y
>
> ┌─┬───┬─┐
>
> │9│0.5│1│
>
> └─┴───┴─┘
>
> Try removing "0
>
>
> Le 2019-05-02 à 22:35, 'Rob Hodgkinson' via Programming a écrit :
> > Hi Piet, not ignorant at all !
> >
> > Try using oblique (an obscure feature is that the u in u/. can be a
> gerund, in which case it is evoked cell wise);
> >
> > g=. *: ` -: `^
> > y=. 3 1 0
> > g /. y
> > 9
> > 0.5
> > 1
> >
> > Found in Section 15 of https://www.jsoftware.com/books/pdf/brief.pdf <
> https://www.jsoftware.com/books/pdf/brief.pdf>.
> >
> > HTH, Regards Rob
> >
> >> On 3 May 2019, at 10:59 am, pietdion <[email protected]> wrote:
> >>
> >> Hopefully not an ignorant question.
> >>
> >> Am looking for a simple (tacit, non complicated) construction (verb?
> >> adverb? conjunction?) “c" that takes a gerund and applies the successive
> >> verbs in the gerund to successive items.
> >>
> >> A simple example is
> >>
> >> g=. *: ` -: `^
> >> y=. 3 1 0
> >> g c y
> >> 9 0.5 1
> >>
> >> What “c” achieves this for arbitrary gerunds g's and y’s?
> >>
> >> I realise this can be done in a variety of explicit ways and with the
> >> agenda construct. All I can come up with is intricate constructions.
> >> Looking for something simple and direct. Seems to have a lot of uses.
> >> ----------------------------------------------------------------------
> >> 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