Re: [Jprogramming] Test which verb was provided to an adverb

2022-05-04 Thread Jose Mario Quintana
I am extremely allergic to explicit adverbs :) However, I think the sentence u^:_1 b. _1 provides the name of the proverb, or its linear representation if it is unnamed (there might be easier ways). For example, test {{ u^:_1 b. _1 }} test datatype test {{ u^:_1 b. _1 }} literal +/@:*:

Re: [Jprogramming] Test which verb was provided to an adverb

2022-05-04 Thread Ric Sherlock
Thanks Raul, Elijah & Jose for your thoughts & discussion. It's somewhat reassuring to know that I wasn't missing anything simple and for my purposes the current solution suffices. Out of interest, is it easier to obtain the name of the verb that "u" in the adverb refers to? On Thu, May 5, 2022 a

Re: [Jprogramming] Test which verb was provided to an adverb

2022-05-04 Thread Jose Mario Quintana
In principle, and in general, the problem of determining whether two (arbitrary given) verbs would produce the same result for an (arbitrary given) argument is non-computable; otherwise, it would imply that the halting problem is decidable (as far as I know and I can see). In practice, I use a con

Re: [Jprogramming] Test which verb was provided to an adverb

2022-05-03 Thread Raul Miller
Certainly. For example: sum=: +/ div=: % len=: # mean=: sum div len avg=: mean f. fdot=: {{ m=. u`'' assert.3=4!:0<'u' if. 1=L.m do.(5!:1 m)`:6 else.m`:6 end. }} mean f.`'' -: avg f.`'' 1 mean fdot`'' -: avg fdot`'' 0 FYI, -- Raul On Tue, May 3, 2022 at 11:56 PM Elijah Stone wro

Re: [Jprogramming] Test which verb was provided to an adverb

2022-05-03 Thread Elijah Stone
There is a programming language-theoretic definition of equivalence (not restricted to functions). It is quite clever, but can be boiled down to: is there a way, within the language, to tell the difference between two values? Because j has no hard abstractions, the question of equality is rathe

Re: [Jprogramming] Test which verb was provided to an adverb

2022-05-03 Thread Raul Miller
There isn't really a better way to do that test. Conceptually, what you want is a test that determines whether two verbs would always produce the same results for the same arguments, but that's a problem involving infinities. It's proof territory. That said, typically we solve this kind of proble

[Jprogramming] Test which verb was provided to an adverb

2022-05-03 Thread Ric Sherlock
I want to test if a particular verb was provided to my adverb. I came up with the solution below. Is there a better way? myadverb = {{ res=. u {:y if. theverb f.`'' -: u f.`'' do. res=. ({.y) ,: res end. res }} -- For