[Jprogramming] Problem with adverbs

'Pascal Jasmin' via Programming programming at jsoftware.com
Tue Jul 19 21:04:28 UTC 2022


it's not a big deal.

a generic polymorphic replacement to @ is:

>: {{if. isNoun 'v' do. u n else. u at v end.}}3
4

 1 >: 2 : 'if. isNoun ''v'' do. u n else. u at v end.' + 3

5

but I think forming trains in form of ([: u n) as an escape when using (`:6) formation (more flexible than "real forks") would help more than domain error.  As example it is possible to do


ari =: 1 : 'if. isNoun ''u'' do. if. (isgerund -. at +. '''' -: ]) m do. m ar else. m end. else.u ar end.'
isgerund =: 0:`(0 -. at e. 3 : ('a =. y (5!:0)';'1')"0)@.(0 < L.) :: 0:

ti =: ari ` ari NB. different from doubleadverb2.ijs: '' is passed to ` . boxed non gerund is ar'd ie a:`u

F1 =: 1 : '(ti u) ti (''''ti) `:6'

doublesum =: + + F1 +

2 doublesum 3

10

 3 + F1 1  NB. `:6 works nicely with m ti verb ti n invocation.

4


F1 is triple modifier that returns fork.  (adverb that returns conjunction) if u in conjunction return could be [: then u of adverb could be a monad, making the modifier approach to forming trains that much more flexible.

2 3 +(/ F1) 1 2 3

3 4 5
4 5 6














On Tuesday, July 19, 2022 at 02:39:19 p.m. EDT, Henry Rich <henryhrich at gmail.com> wrote: 





[:y has the important function of signaling domain error.

Henry Rich

On 7/19/2022 2:35 PM, 'Pascal Jasmin' via Programming wrote:
> I'll add that the fairly recent change of u at n being a constant verb for n is very positive.
>
> Of the approaches I suggested for defining the adverb, the first I prefer.
>
> expecting an adverb to always return a verb is more user friendly than deciding for them.
>
> (>:@1) 3
>
> 2
>
> is good behaviour if the user passes 1 as adverb parameter to (>:@)
>
> 1 (>:@)
>
>> :@1
> Returning a constant verb when provided with a constant or "dynamic" ambivalent (monad+dyad flexibility) execution when provided with a verb is design that will result in fewer edge cases (bugs) when combined with other adverbs that expect, or more importantly, return verbs that tend to be expected by other modifiers.
>
> So. polymorphic return word types from a modifier are design deficient compared to single word types return. Especially considering that a constant verb provides a user intuitive way of obtaining the constant result with the flexibility of using any verb to create a word phrase that can be further processed by modifiers with fewer assumptions about word types.
>
> On a side note, if [:y returned y, there would be additional flexibility in constructing the polymorphic modifier in the form (where ti is ` but turns nouns into gerunds) of {{([: ti >: ti u)(`:6)}}
>
>
> On Tuesday, July 19, 2022 at 12:26:47 p.m. EDT, 'Pascal Jasmin' via Programming <programming at jsoftware.com> wrote:
>
>
>
>
>
> some options,
>
> if you want your adverb to always produce a verb:
>
>   1 (>:@)
>
>> :@1
> 1 (>:@) 4
>
> 2  NB. increment  on constant of 1 (u/m parameter)
>
>    +: (>:@) 4
>
> 9  NB. increment after applying u (double) to y
>
>
> if you want "polymorphism" in your adverb to return noun result or verb depending on u or m,
>
>
> isNoun =: (0 = 4!:0 ::0:)@:<
>
> 1 {{if. isNoun 'u' do. >: m else. >:@u end.}}
>
> 2
>
> + {{if. isNoun 'u' do. >: m else. >:@u end.}}
>
>> :@+
> 2 + {{if. isNoun 'u' do. >: m else. >:@u end.}}3
>
> 6
>
>
>
> On Monday, July 18, 2022 at 04:03:40 a.m. EDT, Jacques Bailhache <jacques.bailhache at gmail.com> wrote:
>
>
>
>
>
> I define an adverb which gives the successor of its argument :
>
>    advsuc =: 1 : '>: u'
>    1 advsuc
> 2
>
> Then I define an adverb which applies its argument to 1 :
>
>    applyto1 =: 1 : '1 u'
>
> Then I apply it to the adverbial successor :
>
>    advsuc applyto1
> advsuc applyto1
>
> Why isn't it evaluated to 2 ?
> ----------------------------------------------------------------------
> 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


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


More information about the Programming mailing list