[Jsource] Why is dual calculated at verb-execution time?

2016-09-18 Thread Henry Rich
Nosing around in cu.c I find static DF1(jtundco1){DECLFG; R df1( w,atop(inv(gs),ampco(fs,gs)));} This is the routine that executes on the verb derived from u&.:v . What I don't understand is why the calculation of the inverse and &: and @ are not performed before the derived verb is created.

Re: [Jsource] Why is dual calculated at verb-execution time?

2016-09-18 Thread Roger Hui
If f=:g&.:h where h is a named verb, and subsequently you change h ... On Sun, Sep 18, 2016 at 8:12 AM, Henry Rich wrote: > Nosing around in cu.c I find > > static DF1(jtundco1){DECLFG; R df1( w,atop(inv(gs),ampco(fs,gs)));} > > This is the routine that executes on the verb derived from u&.:v .

Re: [Jsource] Why is dual calculated at verb-execution time?

2016-09-18 Thread Henry Rich
Oh, yeah. Thanks. I guess there is a possible improvement, but it would take some work to make sure the verbs haven't changed. Or maybe precompute the inverse if g is name-free? Henry On 9/18/2016 11:41 AM, Roger Hui wrote: If f=:g&.:h where h is a named verb, and subsequently you change

Re: [Jsource] Why is dual calculated at verb-execution time?

2016-09-18 Thread Raul Miller
Why would g matter, in this context? Thanks, -- Raul On Sun, Sep 18, 2016 at 12:14 PM, Henry Rich wrote: > Oh, yeah. Thanks. > > I guess there is a possible improvement, but it would take some work to > make sure the verbs haven't changed. > > Or maybe precompute the inverse if g is name-fre

Re: [Jsource] Why is dual calculated at verb-execution time?

2016-09-18 Thread Henry Rich
Oops. I meant h. g could matter, if it has a name, but it wouldn't participate in the inverse. I am thinking: 1. try to get an inverse for h, returning failure if h contains a name 2. see if g contains a name 3. create the h field of the derived verb to contain either inv(gs) or atop(inv(gs

Re: [Jsource] Why is dual calculated at verb-execution time?

2016-09-18 Thread Don Guinn
How about? u&.:(v f.) On Sun, Sep 18, 2016 at 10:55 AM, Henry Rich wrote: > Oops. I meant h. > > g could matter, if it has a name, but it wouldn't participate in the > inverse. > > I am thinking: > > 1. try to get an inverse for h, returning failure if h contains a name > 2. see if g contain

Re: [Jsource] Why is dual calculated at verb-execution time?

2016-09-18 Thread Henry Rich
You can do that if you like, but I am talking about having the code do that automatically if v contains no names. Henry On 9/18/2016 1:06 PM, Don Guinn wrote: How about? u&.:(v f.) On Sun, Sep 18, 2016 at 10:55 AM, Henry Rich wrote: Oops. I meant h. g could matter, if it has a name,

Re: [Jsource] Why is dual calculated at verb-execution time?

2016-09-18 Thread Raul Miller
Mmm I think you need the inverse of h regardless of whether it contains any names. But I guess the point is that you do not need the inverse of h until after g has completed. And organizationally speaking doing the check right at the start (at or near the top level) makes sense. ... That sa

Re: [Jsource] Why is dual calculated at verb-execution time?

2016-09-18 Thread Henry Rich
The point to me is that if you execute f&.g 1000 times, you only need the inverse of g once. Henry On 9/18/2016 1:09 PM, Raul Miller wrote: Mmm I think you need the inverse of h regardless of whether it contains any names. But I guess the point is that you do not need the inverse of h un

Re: [Jsource] Why is dual calculated at verb-execution time?

2016-09-18 Thread Raul Miller
Related, though, is how much time it takes to find if g contains names. If this can be significant, it might be worth going to the extra effort to delay examining it for names until the point where you are prepared to use its inverse. (And, having an "inverse that contains names" be a different re

Re: [Jsource] Why is dual calculated at verb-execution time?

2016-09-18 Thread Henry Rich
Inverses are jtinv() in ai.c. It's pretty fast. I have other fish to fry, but if anyone wanted to add inverses to jtinv, that would be a nice self-contained project that would be of general value. Henry On 9/18/2016 4:16 PM, Raul Miller wrote: Related, though, is how much time it takes to f

Re: [Jsource] Why is dual calculated at verb-execution time?

2016-09-18 Thread 'Pascal Jasmin' via Source
the only "situation" I understand can happen is h =: (3 : 0) .: v1 NB. some condition h =: h .: v2 ) which is an incredibly weak pattern. Because it leaves h in a state that affects the next call. I think in a call to g&.h, that it would be entirely sensible to execute v1 g h y regardless