From 39d095c8dcaad81737ea88611409ce796cb24f0d Mon Sep 17 00:00:00 2001 From: dzaima Date: Wed, 4 Aug 2021 20:32:16 +0300 Subject: [PATCH] =?UTF-8?q?fix=20=E2=80=A2-things=20being=20considered=20p?= =?UTF-8?q?ure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/stuff.c | 2 ++ src/utils/builtins.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/core/stuff.c b/src/core/stuff.c index b0c98d3d..2b23558a 100644 --- a/src/core/stuff.c +++ b/src/core/stuff.c @@ -2,6 +2,7 @@ #include "../utils/mut.h" #include "../utils/utf.h" #include "../utils/talloc.h" +#include "../utils/builtins.h" NORETURN NOINLINE void err(char* s) { @@ -425,6 +426,7 @@ char* format_type(u8 u) { bool isPureFn(B x) { // doesn't consume if (isCallable(x)) { if (v(x)->flags) return true; + if (v(x)->extra >= pf_type) return false; B2B dcf = TI(x,decompose); B xd = dcf(inc(x)); B* xdp = harr_ptr(xd); diff --git a/src/utils/builtins.h b/src/utils/builtins.h index 70ac27b5..0448a312 100644 --- a/src/utils/builtins.h +++ b/src/utils/builtins.h @@ -6,6 +6,7 @@ /* fns.c*/A(ud,"↕") A(fne,"≢") A(feq,"≡") A(ltack,"⊣") A(rtack,"⊢") M(fmtF,"•FmtF") A(indexOf,"⊐") A(memberOf,"∊") A(find,"⍷") A(count,"⊒") \ /* sfns.c*/A(shape,"⥊") A(pick,"⊑") A(pair,"{𝕨‿𝕩}") A(select,"⊏") A(slash,"/") A(join,"∾") A(couple,"≍") A(shiftb,"»") A(shifta,"«") A(take,"↑") A(drop,"↓") A(group,"⊔") A(reverse,"⌽") \ /* sort.c*/A(gradeUp,"⍋") A(gradeDown,"⍒") \ +/* everything before the definition of •Type is defined to be pure, and everything after is not */ \ /* sysfn.c*/M(type,"•Type") M(decp,"•Decompose") M(primInd,"•PrimInd") M(glyph,"•Glyph") A(fill,"•FillFn") M(sys,"•getsys") A(grLen,"•GroupLen") D(grOrd,"•groupOrd") \ /* sysfn.c*/M(repr,"•Repr") A(asrt,"!") A(casrt,"!") M(out,"•Out") M(show,"•Show") M(bqn,"•BQN") \ /* sysfn.c*/D(cmp,"•Cmp") A(hash,"•Hash") M(delay,"•Delay") M(makeRand,"•MakeRand") M(exit,"•Exit") M(getLine,"•GetLine") \