don't keep fl_squoze of not actually guaranteed full squeeze
This commit is contained in:
parent
663c318219
commit
9494ef7b9f
@ -126,9 +126,11 @@ B withFill(B x, B fill) { // consumes both
|
||||
if (isNum(fill)) {
|
||||
x = num_squeezeChk(x);
|
||||
if (elNum(TI(x,elType))) return x;
|
||||
FL_KEEP(x, ~fl_squoze);
|
||||
} else if (isC32(fill)) {
|
||||
x = chr_squeezeChk(x);
|
||||
if (elChr(TI(x,elType))) return x;
|
||||
FL_KEEP(x, ~fl_squoze);
|
||||
}
|
||||
FillArr* r = m_arr(fsizeof(FillArr,a,B,ia), t_fillarr, ia);
|
||||
arr_shCopy((Arr*)r, x);
|
||||
|
||||
@ -200,7 +200,11 @@ NOINLINE B do_fmt(B s, char* p, va_list a) {
|
||||
AFMT("%f", o2f(b));
|
||||
} else { assert(isArr(b) && rnk(b)==1);
|
||||
if (TI(b,elType)==el_c32) AJOIN(inc(b));
|
||||
else AJOIN(chr_squeezeChk(inc(b)));
|
||||
else {
|
||||
B sq = chr_squeezeChk(b);
|
||||
if (!elChr(TI(sq,elType))) FL_KEEP(sq, ~fl_squoze);
|
||||
AJOIN(inc(sq));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -566,7 +570,7 @@ B any_squeeze(B x) {
|
||||
B x0 = GetU(x, 0);
|
||||
if (isNum(x0)) return num_squeeze(x);
|
||||
else if (isC32(x0)) return chr_squeeze(x);
|
||||
return x;
|
||||
return FL_SET(x, fl_squoze);
|
||||
}
|
||||
|
||||
B squeeze_deep(B x) {
|
||||
|
||||
@ -137,10 +137,14 @@ char* format_pm1(u8 u);
|
||||
char* format_pm2(u8 u);
|
||||
bool isPureFn(B x); // doesn't consume
|
||||
B bqn_merge(B x); // consumes
|
||||
|
||||
B any_squeeze(B x); // consumes; accepts any array, returns one with the smallest type (doesn't recurse!)
|
||||
B num_squeeze(B x); // consumes; accepts any array, but only tries to squeeze numerical values; doesn't check for fl_squoze
|
||||
B chr_squeeze(B x); // consumes; accepts any array, but only tries to squeeze character values; doesn't check for fl_squoze
|
||||
B squeeze_deep(B x); // consumes; accepts any object, returns an object with all hashable parts squeezed
|
||||
B squeeze_deep(B x); // consumes; accepts any object, returns an object with all parts necessary for equality checking & hashing squeezed
|
||||
B num_squeeze(B x); // consumes; see note below
|
||||
B chr_squeeze(B x); // consumes; see note below
|
||||
// Note that num_squeeze & chr_squeeze don't check for fl_squoze, and unconditionally set it. Thus, don't call it on an array if it could be squeezable by the opposite method.
|
||||
// or, if you do want to, if TI(x,elType) isn't of the squeezed type, either remove fl_squoze or call the other squeeze function.
|
||||
// The functions below can be used as direct replacements of (num|chr)_squeeze if the argument might already be squeezed.
|
||||
static inline B num_squeezeChk(B x) { return FL_HAS(x,fl_squoze)? x : num_squeeze(x); }
|
||||
static inline B chr_squeezeChk(B x) { return FL_HAS(x,fl_squoze)? x : chr_squeeze(x); }
|
||||
B def_fn_uc1(B t, B o, B x);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user