a few neat ways to use new gerund"r

+:`-:"0 ] 2 3 4

4 1.5 8

+: each`(-: each)"0 ] 2 3 ; 4 5 6

┌───┬───────┐

│4 6│2 2.5 3│

└───┴───────┘

+:`-:"0 each 2 3 ; 4 5 6 
 ┌─────┬────────┐ 
 │4 1.5│8 2.5 12│ 
 └─────┴────────┘





On Tuesday, September 17, 2019, 05:13:25 p.m. EDT, Ric Sherlock 
<[email protected]> wrote: 





I saw the gerund"r facility and was thinking I should be able to work out
how to use it to replace/simplify

NB.*eachunderv c Applies verb in gerund m to corresponding cell of y
NB. m is gerund, v is a verb.  [x] (k{u)`:6 &. v is applied to cell k of y
NB. NB.
http://www.jsoftware.com/pipermail/programming/2009-August/015982.html
NB. Has spec equivalent to conjunction "respectively" in
misc/miscutils/utils
eachunderv=: conjunction define
  m v 1 :(':';'x `:6&.u y')"_1 y
:
  m v 1 :(':';'x `:6&.u&>/ y')"_1 x ,&<"_1 y
)
e.g.
  +:`*:`-:`%: eachunderv> ] 2;3;6;10

┌─┬─┬─┬───────┐

│4│9│3│3.16228│

└─┴─┴─┴───────┘

I note that the conjunction can now be simplified to:

eachunderv=: conjunction define
  m v 1 :('x `:6&.u y')"_1 y
:
  m v 1 :('x `:6&.u&>/ y')"_1 x ,&<"_1 y
)
but apart from
  (+:&.>)`(*:&.>)`(-:&.>)`(%:&.>)"0  ] 2;3;6;10

I'm not seeing a way to utilise the new gerund"r functionality in this case?


On Tue, Sep 17, 2019 at 1:29 PM Henry Rich <[email protected]> wrote:

> This beta has all the language changes planned for the 9.01 release.  A
> list of them is at
>
>
> https://code.jsoftware.com/wiki/System/ReleaseNotes/J901#Changes_to_the_J_engine
>
> There is a new one in this beta, one that we have been missing for a
> long time: a way to apply a different verb to each cell of an argument.
> This is now provided by
>
> gerund"r
>
> where r is not infinite.
>
> Henry Rich
>
>
> On 9/16/2019 7:09 PM, Eric Iverson wrote:
> > 901-beta-k is available.
> >
> > This version has an avx2 JE. There are now 3 standard JEs for intel 64
> bit
> > platforms. If your hardware supports avx2 (2!:7''), then your JVERSION
> will
> > indicate j64avx2 after you update to beta-k.
> >
> > If JVERSION indicates you have beta-h or later, then get the latest with:
> >
> >    load'pacman'
> >    je_update_jpacman_''
> >
> > If on an older version, you need a few extra steps:
> >
> > pacman update to the latest base library and restart J
> >    load'pacman''
> >    je_update_jpacman_'' NB. 1st time gets nonavx version - restart
> >    je_update_jpacman_'' NB. 2nd time might get avx or avx2 - restart
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
>
> ---
> This email has been checked for viruses by AVG.
> https://www.avg.com

>
> ----------------------------------------------------------------------
> 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