an=.  <@:((,'0') (,&:<) ])    NB. Atomizing words (monadic verb)

   f=. '(x , an y)`:6' (dyad :)  NB. Explicit compliant version

   (*:`+:) f 4
64


   train=. (<'`:')(0:`)(,^:)&6

   f=. train@:([ , an@:]) f.     NB. Non-compliant fixed tacit version

   (*:`+:) f 4
64


   f=. "..@:([ , "..inv@:])      NB. Non-compliant fixed tacit Jx version

   (*:`+:) f 4
64


On Sun, Sep 24, 2017 at 6:43 AM, Rob Moore <robmoore...@gmail.com> wrote:

> Hi guys,
>
> I am wondering if there already exists a way of doing something that I
> want, which is an elementary enough operation that I was quite surprised to
> not have found it in jvoc/evoke gerund.
>
>
> If I have some gerund say *:`+: I am looking for some function which will
> apply the gerund's constituents in order (from right to left of course)
> monadically to some noun.
>
>
> For example '(*:`+:) f 4' should be equivalent to '*: +: 4' (which is 64)
>
>
> My current solution is functional but unsatisfactory. Convert gerund to
> string, append the (string) argument and then apply 'do' ".
>
>
> composeGerund=:".@:((,@:(,"1&' ')@:>@:[) , ])
>
>
> e.g:
>
>
>     gerund=:*:`+:
>
>     , ,"1&' ' >gerund
>
> *: +:
>
>     (, ,"1&' ' >gerund) , '4'
>
> *: +: 4
>
>     ". (, ,"1&' ' >gerund) , '4'
>
> 64
>
>
> I don't want to have to specify my right argument as a string, I want to
> pass in variables by value!
>
>
> Does anyone have a good solution?
>
>
> Cheers,
>
>
> Rob
> ----------------------------------------------------------------------
> 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