Skip to content

Commit

Permalink
Expunge eva/evc
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryHRich committed Nov 3, 2024
1 parent 37c91fe commit 16979b1
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 15 deletions.
9 changes: 6 additions & 3 deletions jsrc/ai.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ A jtinvamp(J jt, A f, A g, A fampg){A ff,h,x,y;B nf,ng;C c,d,*yv;I n;V*u,*v;
R amp(sc(-(1^(-n))),h);
case CCANT:
ASSERT(nf!=0,EVDOMAIN);
R obverse(eva(x,"] |:~ u C.^:_1 i.@#@$"),fampg?fampg:amp(f,g));
// obsolete R obverse(eva(x,"] |:~ u C.^:_1 i.@#@$"),fampg?fampg:amp(f,g));
R obverse(ev12(x,0,"(]: C.^:_1 i.@#@$) |: ]"),fampg?fampg:amp(f,g));
case CPCO:
if(nf){
RE(n=i0(x));
Expand Down Expand Up @@ -174,11 +175,13 @@ A jtinvamp(J jt, A f, A g, A fampg){A ff,h,x,y;B nf,ng;C c,d,*yv;I n;V*u,*v;
case CBASE:
if(!nf)break;
R AR(x) ? amp(x,ds(CABASE)) :
obverse(evc(x,mag(x),"$&u@>:@(v&(<.@^.))@(1&>.)@(>./)@:|@, #: ]"),fampg?fampg:amp(f,g));
// obsolete obverse(evc(x,mag(x),"$&u@>:@(v&(<.@^.))@(1&>.)@(>./)@:|@, #: ]"),fampg?fampg:amp(f,g));
obverse(ev12(x,0,"($&]:@>:@<. ([.@((^.~|)&].)))@(1&>.)@(>./)@:|@, #: ]"),fampg?fampg:amp(f,g));
case CATOMIC:
if(!nf){ASSERT(equ(x,nub(x)),EVDOMAIN); R obverse(atop(f,amp(x,ds(CIOTA))),fampg?fampg:amp(f,g));} // fall through to common obverse (?)
case CCYCLE:
if(nf&&AR(x)<=(c==CCYCLE))R obverse(eva(fampg?fampg:amp(f,g),"/:@u@(i.@#) { ]"),fampg?fampg:amp(f,g)); break;
// obsolete if(nf&&AR(x)<=(c==CCYCLE))R obverse(eva(fampg?fampg:amp(f,g),"/:@u@(i.@#) { ]"),fampg?fampg:amp(f,g)); break;
if(nf&&AR(x)<=(c==CCYCLE))R obverse(ev12(fampg?fampg:amp(f,g),0,"/:@]:@(i.@#) { ]"),fampg?fampg:amp(f,g)); break;
case CDROP:
if(!(nf&&1>=AR(x)))break;
RZ(x=cvt(INT,x));
Expand Down
2 changes: 1 addition & 1 deletion jsrc/am.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ static A jtgadv(J jt,A w){A hs;I n;
// The derived verb is ASGSAFE if all the components are; it has gerund left-operand; and it supports inplace operation on the dyad
I alr=atoplr(AAV(hs)[0]); // Also set the LSB flags to indicate whether v0 is u@[ or u@]
I flag=VASGSAFE; // where we will build verb flags, inited as if wn<3
if(wn==3){if(FAV(AAV(hs)[2])->id==CRIGHT)AS(hs)[0]=2; else flag=FAV(AAV(hs)[2])->flag;} // 3 is scaf if v2=], remove it from gerund count in shape (leave in AN for free); if 3 gerunds, init from v2
if(wn==3){if(FAV(AAV(hs)[2])->id==CRIGHT)AS(hs)[0]=2; else flag=FAV(AAV(hs)[2])->flag;} // if v2=], remove it from gerund count in shape (leave in AN for free); if 3 gerunds, init from v2
flag=(flag&FAV(AAV(hs)[0])->flag&FAV(AAV(hs)[1])->flag&VASGSAFE)+(VGERL|VJTFLGOK2)+(alr-2>0?alr-2:alr); // wn may be 2 or 3
R fdef(0,CRBRACE,VERB, jtgav1,jtgav2, w,0L,hs,flag, RMAX,RMAX,RMAX); // create the derived verb
}
Expand Down
4 changes: 2 additions & 2 deletions jsrc/j.h
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ struct jtimespec jmtfclk(void); //'fast clock'; maybe less inaccurate; intended

// The named-call stack is used only when there is a locative, EXCEPT that after a call to 18!:4 it is used until the function calling 18!:4 returns.
// Since startup calls 18!:4 without a name, we have to allow for the possibility of deep recursion in the name stack. Normally only a little of the stack is used
#if defined(CSTACKSIZE)
#if defined(CSTACKSIZE) // some builds explicitly override the stacksize
#if !defined(CSTACKRESERVE)
#error CSTACKSIZE and CSTACKRESERVE must be defined together
#endif
Expand All @@ -621,9 +621,9 @@ struct jtimespec jmtfclk(void); //'fast clock'; maybe less inaccurate; intended
#define CSTACKSIZE (SY_64?7946240:1015808) // OS default stack size 8MB, aligned to 16k system page size
#endif
#endif
#define CSTACKDEBUGRESERVE (SY_64?100000:50000) // amount to allow for debugger
#define CSTACKRESERVE (SY_64?200000:10000) // amount we allow for slop before we sample the stackpointer, and after the last check
#endif
#define CSTACKDEBUGRESERVE (CSTACKRESERVE>>1) // minimum to allow for debugger
//The named-function stack is intelligent
// and stacks only when there is a locale change or deletion; it almost never limits unless locatives are used to an extreme degree.
// The depth of the C stack will normally limit stack use.
Expand Down
6 changes: 3 additions & 3 deletions jsrc/ja.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@
#define detxm(x,y) jtdetxm(jt,(x),(y))
#define detz(x) jtdetz(jt,(x))
#define df1(r,x,y) (r=((r=(y))?(FAV(r)->valencefns[0])((J)((I)jt|(AT(r)&(ADV|CONJ)?JTXDEFMODIFIER:0)),(x),r,r):r)) // y is self; if not 0, execute (x,self,self). Put result into r, set r 0 if self=0.
// r must not = x. self is evaluated only once. If we call a modifier, set that flag scaf should replace with df[mv][12] forms
// r must not = x. self is evaluated only once. If we call a modifier, set that flag
#define dfv1(r,x,y) (r=((r=(y))?(FAV(r)->valencefns[0])(jt,(x),r,r):r)) // z is self, always a verb
// r must not = x. self is evaluated only once. If we call a modifier, set that flag
#define dfv2(r,x,y,z) (r=((r=(z))?(FAV(r)->valencefns[1])(jt,(x),(y),r):r)) // z is self, always a verb Put result into r, set r 0 if self=0. r must not = x or y. self is evaluated only once
Expand Down Expand Up @@ -325,9 +325,9 @@
#define etc(x) jtetc(jt,(x))
#define ev12(x,y,z) jtev12(jt,(x),(y),(z))
// obsolete #define ev2(x,y,z) jtev2(jt,(x),(y),(z))
#define eva(x,y) jteva(jt,(x),(y))
// obsolete #define eva(x,y) jteva(jt,(x),(y))
#define eval(x) jteval(jt,(x))
#define evc(x,y,z) jtevc(jt,(x),(y),(z))
// obsolete #define evc(x,y,z) jtevc(jt,(x),(y),(z))
#define even(x,y) jteven(jt,(x),(y))
#define every(x,y) jtevery(jt,(x),(y))
#define every2(x0,x1,x2) jtevery2(jt,(x0),(x1),(x2))
Expand Down
4 changes: 2 additions & 2 deletions jsrc/je.h
Original file line number Diff line number Diff line change
Expand Up @@ -744,9 +744,9 @@ extern B jtequ0(J,A,A);
extern void jterasenl(J,I);
// obsolete extern A jtev1(J,A,C*);
extern A jtev12(J,A,A,C*);
extern A jteva(J,A,C*);
// obsolete extern A jteva(J,A,C*);
extern A jteval(J,C*);
extern A jtevc(J,A,A,C*);
// obsolete extern A jtevc(J,A,A,C*);
extern DF1(jtevery);
extern DF2(jtevery2);
extern DF1(jteveryself);
Expand Down
7 changes: 4 additions & 3 deletions jsrc/px.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ A jteval(J jt,C*s){R PARSERVALUE(parseforexec(tokens(cstr(s),1+!!EXPLICITRUNNING

// obsolete A jtev1(J jt, A w,C*s){A z; R df1(z, w,eval(s));} // parse *s and apply to w //
// obsolete A jtev2(J jt,A a,A w,C*s){A z; R df2(z,a,w,eval(s));} // parse *s and apply to a and w. If w is 0, use monad
A jtev12(J jt,A a,A w,C*s){A z; A fs; I dyad=w!=0; RZ(fs=eval(s)); R (FAV(fs)->valencefns[dyad])(jt,a,dyad?w:fs,fs);} // parse *s to verb, and apply to a and w. If w is 0, use monad
A jteva(J jt, A w,C*s){A z; R df1(z, w,colon(num(1), cstr(s)));} // parse to adverb
A jtevc(J jt,A a,A w,C*s){A z; R df2(z,a,w,colon(num(2),cstr(s)));} // parse to conjunction
// parse string s, producing an ACV, and apply the ACV as either a monad or a dyad. w=0 if monad. Result can be anything; use only when you control a, w, and s
A jtev12(J jt,A a,A w,C*s){A z; A fs; RZ(fs=eval(s)); R (FAV(fs)->valencefns[!!w])((J)((I)jt+(AT(fs)&VERB?0:JTXDEFMODIFIER)),a,w?w:fs,fs);} // if modifier, so flag (for unquote & xdefn, so not needed)
// obsolete A jteva(J jt, A w,C*s){A z; R df1(z, w,colon(num(1), cstr(s)));} // parse to adverb
// obsolete A jtevc(J jt,A a,A w,C*s){A z; R df2(z,a,w,colon(num(2),cstr(s)));} // parse to conjunction

// ". y
DF1(jtexec1){A z;
Expand Down
3 changes: 2 additions & 1 deletion jsrc/v0.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ DF1(jtpoly1){A c,e,x;
RZ(IRS1(x,0L,1L,jthead,c)); // c = {."1>y = list of coefficients
RZ(IRS1(x,0L,1L,jttail,e)); // e = {:"1>y = list of exponents
ASSERT(equ(e,floor1(e))&&all1(le(num(0),e)),EVDOMAIN); // insist on nonnegative integral exponents
R evc(c,e,"u v}(1+>./v)$0"); // evaluate c 2 : 'u v}(1+>./v)$0' e
// obsolete R evc(c,e,"u v}(1+>./v)$0"); // evaluate c 2 : 'u v}(1+>./v)$0' e
R ev12(c,e,"[`]`(0 $~ >:@(>./)@])}"); // evaluate c 2 : 'u v}(1+>./v)$0' e
}


Expand Down

0 comments on commit 16979b1

Please sign in to comment.