don't need an actual function object for eachd_fn / eachm_fn
This commit is contained in:
parent
4a45a07a2b
commit
a650051a82
@ -485,40 +485,27 @@ B rank_c2(Md2D* d, B w, B x) { B f = d->f; B g = d->g;
|
||||
|
||||
|
||||
// TODO fills on EACH_FILLS
|
||||
NFnDesc* depthfDesc;
|
||||
B depthf_c1(B t, B x) {
|
||||
if (isArr(x)) return eachm_fn(t, x, depthf_c1);
|
||||
else return c1(nfn_objU(t), x);
|
||||
else return c1(t, x);
|
||||
}
|
||||
B depthf_c2(B t, B w, B x) {
|
||||
if (isArr(w) || isArr(x)) return eachd_fn(t, w, x, depthf_c2);
|
||||
else return c2(nfn_objU(t), w, x);
|
||||
else return c2(t, w, x);
|
||||
}
|
||||
extern B rt_depth;
|
||||
B depth_c1(Md2D* d, B x) {
|
||||
if (isF64(d->g) && o2fG(d->g)==0) {
|
||||
if (isArr(x)) {
|
||||
B f = m_nfn(depthfDesc, incG(d->f));
|
||||
B r = eachm_fn(f, x, depthf_c1);
|
||||
decG(f);
|
||||
return r;
|
||||
} else {
|
||||
return c1(d->f, x);
|
||||
}
|
||||
if (isArr(x)) return eachm_fn(d->f, x, depthf_c1);
|
||||
else return c1(d->f, x);
|
||||
}
|
||||
SLOW3("!F⚇𝕨 𝕩", d->g, x, d->f);
|
||||
return m2c1(rt_depth, d->f, d->g, x);
|
||||
}
|
||||
B depth_c2(Md2D* d, B w, B x) {
|
||||
if (isF64(d->g) && o2fG(d->g)==0) {
|
||||
if (isArr(w) || isArr(x)) {
|
||||
B f = m_nfn(depthfDesc, incG(d->f));
|
||||
B r = eachd_fn(f, w, x, depthf_c2);
|
||||
decG(f);
|
||||
return r;
|
||||
} else {
|
||||
return c2(d->f, w, x);
|
||||
}
|
||||
if (isArr(w) || isArr(x)) return eachd_fn(d->f, w, x, depthf_c2);
|
||||
else return c2(d->f, w, x);
|
||||
}
|
||||
SLOW3("!𝕨 𝔽⚇f 𝕩", w, x, d->g);
|
||||
return m2c2(rt_depth, d->f, d->g, w, x);
|
||||
@ -538,6 +525,3 @@ void md2_init() {
|
||||
TIi(t_md2BI,m2_ix) = md2BI_ix;
|
||||
c(BMd2,bi_before)->uc1 = before_uc1;
|
||||
}
|
||||
void md2Post_init() {
|
||||
depthfDesc = registerNFn(m_c8vec_0("(depth fn)"), depthf_c1, depthf_c2);
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
#define PRECOMPILED_FILE1(X) PRECOMPILED_FILE0(X)
|
||||
#define PRECOMPILED_FILE(END) PRECOMPILED_FILE1(../build/BYTECODE_DIR/gen/END)
|
||||
|
||||
#define FOR_INIT(F) F(base) F(harr) F(mutF) F(cmpA) F(fillarr) F(tyarr) F(hash) F(sfns) F(fns) F(arith) F(md1) F(md2) F(derv) F(comp) F(rtWrap) F(ns) F(nfn) F(sysfn) F(inverse) F(slash) F(search) F(load) F(sysfnPost) F(dervPost) F(md2Post) F(ryu) F(ffi) F(mmap) F(typesFinished)
|
||||
#define FOR_INIT(F) F(base) F(harr) F(mutF) F(cmpA) F(fillarr) F(tyarr) F(hash) F(sfns) F(fns) F(arith) F(md1) F(md2) F(derv) F(comp) F(rtWrap) F(ns) F(nfn) F(sysfn) F(inverse) F(slash) F(search) F(load) F(sysfnPost) F(dervPost) F(ryu) F(ffi) F(mmap) F(typesFinished)
|
||||
#define F(X) NOINLINE void X##_init(void);
|
||||
FOR_INIT(F)
|
||||
#undef F
|
||||
|
||||
Loading…
Reference in New Issue
Block a user