native empty ˘ & ⎉ cleanup

This commit is contained in:
dzaima 2022-06-09 04:00:04 +03:00
parent b862d7c075
commit 021fd5d8c3
3 changed files with 9 additions and 10 deletions

View File

@ -416,10 +416,10 @@ static B m1c2(B t, B f, B w, B x) { // consumes w,x
#endif
extern B to_fill_cell_k(B x, ur k, char* err); // from md2.c
static B to_fill_cell(B x) { // consumes x
static B to_fill_cell_1(B x) { // consumes x
return to_fill_cell_k(x, 1, "˘: Empty argument too large (%H ≡ ≢𝕩)");
}
static B merge_fill_result(B rc) {
static B merge_fill_result_1(B rc) {
u64 rr = isArr(rc)? rnk(rc)+1ULL : 1;
if (rr>UR_MAX) thrM("˘: Result rank too large");
B rf = getFillQ(rc);
@ -435,12 +435,12 @@ static B merge_fill_result(B rc) {
}
B cell2_empty(B f, B w, B x, ur wr, ur xr) {
if (!isPureFn(f) || !CATCH_ERRORS) { dec(w); dec(x); return emptyHVec(); }
if (wr) w = to_fill_cell(w);
if (xr) x = to_fill_cell(x);
if (wr) w = to_fill_cell_1(w);
if (xr) x = to_fill_cell_1(x);
if (CATCH) return emptyHVec();
B rc = c2(f, w, x);
popCatch();
return merge_fill_result(rc);
return merge_fill_result_1(rc);
}
B cell_c1(Md1D* d, B x) { B f = d->f;
@ -454,11 +454,11 @@ B cell_c1(Md1D* d, B x) { B f = d->f;
usz cam = a(x)->sh[0];
if (cam==0) {
if (!isPureFn(f) || !CATCH_ERRORS) { decG(x); return emptyHVec(); }
B cf = to_fill_cell(x);
B cf = to_fill_cell_1(x);
if (CATCH) return emptyHVec();
B rc = c1(f, cf);
popCatch();
return merge_fill_result(rc);
return merge_fill_result_1(rc);
}
S_SLICES(x)
M_HARR(r, cam);

View File

@ -219,7 +219,7 @@ B to_fill_cell_k(B x, ur k, char* err) { // consumes x
B xf = getFillQ(x);
if (noFill(xf)) xf = m_f64(0);
ur cr = rnk(x)-k;
usz *sh = a(x)->sh+k;
usz* sh = a(x)->sh+k;
usz csz = 1;
for (usz i=0; i<cr; i++) if (mulOn(csz, sh[i])) thrF(err, x);
MAKE_MUT(fc, csz);

View File

@ -104,7 +104,7 @@ B comp_currSrc;
B comp_currRe;
B rt_undo, rt_select, rt_slash, rt_join, rt_ud, rt_pick, rt_take, rt_drop, rt_insert, rt_depth,
rt_group, rt_under, rt_reverse, rt_indexOf, rt_count, rt_memberOf, rt_find, rt_cell, rt_rank, rt_transp;
rt_group, rt_under, rt_reverse, rt_indexOf, rt_count, rt_memberOf, rt_find, rt_rank, rt_transp;
Block* load_compObj(B x, B src, B path, Scope* sc) { // consumes x,src
SGet(x)
usz xia = a(x)->ia;
@ -396,7 +396,6 @@ void load_init() { // very last init function
rt_count = Get(rtObjRaw, n_count ); gc_add(rt_count);
rt_memberOf= Get(rtObjRaw, n_memberOf); gc_add(rt_memberOf);
rt_find = Get(rtObjRaw, n_find ); gc_add(rt_find);
rt_cell = Get(rtObjRaw, n_cell ); gc_add(rt_cell);
rt_rank = Get(rtObjRaw, n_rank ); gc_add(rt_rank);
rt_transp = Get(rtObjRaw, n_transp ); gc_add(rt_transp);
rt_depth = Get(rtObjRaw, n_depth ); gc_add(rt_depth);