According to one school of though a blank space is the best looking
separator. One can define a recurrent tacit fixed adverb (lt), based on
the adverb sb using the latest Wicked Tacit Toolkit mentioned recently [0],
as follows,
lt=. train o ([<adv , ([ , [<adv , ])/ , ]<adv c)f.sb
[: v0 v1 v2 v3 lt NB. [: is used as a guard
[ v0 [ v1 [ v2 [ v3 ]
[: !@# $ % ^&* (- +) lt
[ !@# [ $ [ % [ ^&* [ (- +) ]
Some go further and prefer having no separators when possible,
7([:+-*lt)5
_21
[:!@#$%^&*(-+)lt
[ !@# [ $ [ % [ ^&* [ (- +) ]
How does it work? The idea is to use a higher-order verb that takes a list
of boxed verbs,
[: v0 v1 v2 v3 ]sb
┌──┬──┬──┬──┐
│v0│v1│v2│v3│
└──┴──┴──┴──┘
inserts the verb [ boxed ([<adv),
( ([ , [<adv , ])/ ) [: v0 v1 v2 v3 ]sb
┌──┬─┬──┬─┬──┬─┬──┐
│v0│[│v1│[│v2│[│v3│
└──┴─┴──┴─┴──┴─┴──┘
prepends the verb [ boxed and postpends the verb ] boxed,
([<adv , ([ , [<adv , ])/ , ]<adv c) [: v0 v1 v2 v3 ]sb
┌─┬──┬─┬──┬─┬──┬─┬──┬─┐
│[│v0│[│v1│[│v2│[│v3│]│
└─┴──┴─┴──┴─┴──┴─┴──┴─┘
and produces its train,
train o ([<adv , ([ , [<adv , ])/ , ]<adv c) [: v0 v1 v2 v3 ]sb
[ v0 [ v1 [ v2 [ v3 ]
The definition of sb is such that v [: ... ]sb and [: ... v sb match,
[: v0 v1 v2 v3 train o ([<adv , ([ , [<adv , ])/ , ]<adv c) sb
[ v0 [ v1 [ v2 [ v3 ]
PS. Higher-order verb sounds more legit than wicked verb.
PPS. Beware of anyone that uses legit as a synonym of legitimate!
[0] [Jprogramming] Are closures possible in J?
http://www.jsoftware.com/pipermail/programming/2016-July/045481.html
On Tue, Jul 12, 2016 at 10:00 AM, 'Pascal Jasmin' via Programming <
[email protected]> wrote:
> The simplest and most general approach,
>
> 7 ([ + [ - *) 5
> _21
>
>
> as an conjunction dyadicCompose
>
> dyC =: 2 : '[ u v'
>
> 7 + dyC - dyC * 5
> _21
>
> ----- Original Message -----
> From: Rob Hodgkinson <[email protected]>
> To: [email protected]
> Sent: Tuesday, July 12, 2016 9:12 AM
> Subject: Re: [Jprogramming] Question about dyadic verb composition
>
> Also perhaps a gerund reduction approach, but you would need to replicate
> the arguments …
>
> 7 ([ + [ - [ * ]) 5
> _21
>
>
> +`-`*/7 7 7 5
> _21
>
> You could wrap this in a function also to do the replication based on
> $gerund.
>
> foo
> 4 : ' r=:x/(($x),1)#y'
>
> (+`-`*) foo 7 5
> _21
>
> Regards Rob
>
>
> > On 12 Jul 2016, at 11:04 PM, Raul Miller <[email protected]> wrote:
> >
> > No, but you can make one.
> >
> > For example:
> >
> > x(((<<<_2){{.,@,.}.)[`u`v`w`...`])y
> >
> > I hope this helps.
> >
> > --
> > Raul
> >
> >
> > On Tue, Jul 12, 2016 at 8:38 AM, dahn oak <[email protected]>
> wrote:
> >> Hello, is there any language cunstruction that is equivalent to:
> >> x u x v x w ... y
> >> where x and y are the arguments of the construction and u,v,w,... is a
> sequence
> >> of dyadic verbs?
> >>
> >> I just don't want to duplicate my x argument many times. Specifically,
> I want
> >> to do something like 10,~10,.~10,10,.y where y is a scalar matrix to
> make a
> >> "border" for it (number 10).
> >>
> >> dahn oak - [email protected]
> >> ----------------------------------------------------------------------
> >> 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