fix 0˝˘ 2‿2⥊0

This commit is contained in:
dzaima 2023-04-29 21:15:46 +03:00
parent 0a30c7b4e6
commit 048352f587
3 changed files with 5 additions and 4 deletions

View File

@ -90,8 +90,9 @@ static inline bool isPervasiveDy (B x) { return (u8)(v(x)->flags-1) <= n_ge; }
static inline bool isPervasiveMon(B x) { return (u8)(v(x)->flags-1) <= n_stile; }
static bool isPervasiveDyExt(B x) {
assert(isFun(x));
if (isPervasiveDy(x)) return true;
if (isFun(x) && TY(x)==t_md1D) {
if (TY(x)==t_md1D) {
Md1D* d = c(Md1D, x);
if (d->m1->flags-1 == n_swap) return isPervasiveDy(d->f);
}

View File

@ -333,7 +333,7 @@ B for_cells_c1(B f, u32 xr, u32 cr, u32 k, B x, u32 chr) { // F⎉cr x, with arr
Md1D* fd = c(Md1D,f);
u8 rtid = fd->m1->flags-1;
if (rtid==n_const) { f=fd->f; goto const_f; }
if ((rtid==n_fold || rtid==n_insert) && TI(x,elType)!=el_B && k==1 && xr==2 && isPervasiveDyExt(fd->f)) { // TODO extend to any rank x with cr==1
if ((rtid==n_fold || rtid==n_insert) && TI(x,elType)!=el_B && k==1 && xr==2 && isFun(fd->f) && isPervasiveDyExt(fd->f)) { // TODO extend to any rank x with cr==1
usz *sh = SH(x); usz m = sh[1];
if (m == 1) return select_cells(0, x, cam, k, false);
if (m <= 64 && m < sh[0]) return fold_rows(fd, x);

View File

@ -337,9 +337,9 @@ B insert_c1(Md1D* d, B x) { B f = d->f;
if (xia==0) { SLOW2("!𝕎˝𝕩", f, x); return m1c1(rt_insert, f, x); }
if (isFun(f)) {
u8 rtid = v(f)->flags-1;
if (RNK(x)==1 && isPervasiveDyExt(f)) return m_unit(fold_c1(d, x));
ur xr = RNK(x);
if (xr==1 && isPervasiveDyExt(f)) return m_unit(fold_c1(d, x));
if (rtid == n_join) {
ur xr = RNK(x);
if (xr==1) return x;
ShArr* rsh;
if (xr>2) {