I have used similar tools for related purposes before; nowadays I use the
word-from-linear (104!:1) extension. It is not a secret that I have an
aversion to explicit definitions; one reason is that they change the
context:
wl=. 104!:1
eval =: 1 : ' a: 1 : m'
< '@' eval +'/' eval 1 2 3
┌─┐
│6│
└─┘
< '@' wl +'/' wl 1 2 3
┌─┐
│6│
└─┘
So far, so good; however,
@u
@u
'@u'wl
@u
'@u'eval
@a:
PS. Apply (128!:2) only can refer to a verb that take a single argument,
and J verbs can take only one or two arguments. I regard both situations
as very minor annoyances. It is not difficult to circumvent this
“limitation” of apply (and, of course, J verbs can take virtually several
arguments), for example,
2 ('+/' apply ,) 3
5
PPS. For the record: perhaps apply (128!:2) should not produce adverbs or
conjunctions (or verbs); but, it can.
On Sat, Apr 5, 2014 at 1:26 PM, Pascal Jasmin <[email protected]>wrote:
> apply does not work with dyadic verbs, and cannot produce modifiers.
> Consider the following simple looking eval function.
>
> eval =: 1 : ' a: 1 : m'
>
>
> 2 '+' eval 1 2 3
> 3 4 5
>
>
> + '/' eval 1 2 3
> 6
>
>
>
> '+/' eval(+:@) 1 2 3
> 12
>
>
> +:@+'/' eval 1 2 3
> 22
>
>
> +: +'/' eval 1 2 3
> 12
>
>
> (+: '@' eval +)'/' eval 1 2 3
>
> 22
>
> +: '@' eval +'/' eval 1 2 3
> 12
>
>
> The last statement is interesting because it seems to alter the normal
> conjunction train processing (sometimes in desirable ways)
>
> instead of just grabbing a single token as v.
>
> < '@' eval +'/' eval 1 2 3 NB. would be domain error without '@'eval
> ┌─┐
> │6│
> └─┘
>
>
> eval is the key to how my multiline tacit code works:
> http://www.jsoftware.com/jwiki/PascalJasmin/Multiline%20tacit%20expressions%20with%20macros
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm