From 624c74058c25a62ddf5bdc461f03ebaf83e38eaa Mon Sep 17 00:00:00 2001 From: dzaima Date: Fri, 30 May 2025 02:08:59 +0300 Subject: [PATCH] improve pure function detection --- src/core/stuff.c | 43 +++++++++++++++++++++++++++---------------- test/cases/fills.bqn | 8 ++++++++ test/cases/system.bqn | 16 ++++++++++++++-- 3 files changed, 49 insertions(+), 18 deletions(-) diff --git a/src/core/stuff.c b/src/core/stuff.c index 923d12dd..edcf8420 100644 --- a/src/core/stuff.c +++ b/src/core/stuff.c @@ -439,22 +439,33 @@ char* eltype_repr(u8 u) { } } bool isPureFn(B x) { // doesn't consume - if (isCallable(x)) { - if (isPrim(x)) return true; - B2B dcf = TI(x,decompose); - B xd = dcf(inc(x)); - B* xdp = harr_ptr(xd); - i32 t = o2iG(xdp[0]); - if (t<2) { decG(xd); return t==0; } - usz xdia = IA(xd); - for (u64 i = 1; i