From d2682c595b05a9092ee1ef253ad7a207bdb90cf9 Mon Sep 17 00:00:00 2001 From: dzaima Date: Sat, 22 Jan 2022 19:34:40 +0200 Subject: [PATCH] =?UTF-8?q?native=20dyadic=20=CB=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/builtins/md1.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/builtins/md1.c b/src/builtins/md1.c index de787df4..fdd64c4c 100644 --- a/src/builtins/md1.c +++ b/src/builtins/md1.c @@ -479,7 +479,21 @@ B insert_c1(Md1D* d, B x) { B f = d->f; E_SLICES(x) return r; } -B insert_c2(Md1D* d, B w, B x) { return m1c2(rt_insert, d->f, w, x); } +B insert_c2(Md1D* d, B w, B x) { B f = d->f; + if (isAtm(x) || rnk(x)==0) thrM("˝: 𝕩 must have rank at least 1"); + usz xia = a(x)->ia; + B r = w; + if (xia!=0) { + S_SLICES(x) + usz p = xia; + while(p!=0) { + p-= x_csz; + r = c2(f, SLICE(x, p), r); + } + E_SLICES(x) + } + return r; +} #pragma GCC diagnostic pop