native ⁼

This commit is contained in:
dzaima 2021-11-21 21:27:08 +02:00
parent f55e349999
commit f155792856
3 changed files with 23 additions and 7 deletions

View File

@ -17,6 +17,7 @@
#define FOR_PM1(A,M,D) \ #define FOR_PM1(A,M,D) \
/*md1.c*/A(tbl,"") A(each,"¨") A(fold,"´") A(scan,"`") A(const,"˙") A(swap,"˜") A(cell,"˘") \ /*md1.c*/A(tbl,"") A(each,"¨") A(fold,"´") A(scan,"`") A(const,"˙") A(swap,"˜") A(cell,"˘") \
/*inverse.c*/A(undo,"") \
/* everything before the definition of •_timed is defined to be pure, and everything after is not */ \ /* everything before the definition of •_timed is defined to be pure, and everything after is not */ \
/*md1.c*/A(timed,"•_timed") /*md1.c*/A(timed,"•_timed")

View File

@ -24,6 +24,21 @@ B fun_invSwap_c2(B t, B w, B x) {
return TI(f, fn_iw)(f, w, x); return TI(f, fn_iw)(f, w, x);
} }
extern B rt_undo;
B undo_c1(Md1D* d, B x) { B f = d->f;
if (isFun(f)) return TI(f, fn_im)(f, x);
B fi = m1_d(incG(rt_undo), inc(f));
B r = c1(fi, x);
dec(fi);
return r;
}
B undo_c2(Md1D* d, B w, B x) { B f = d->f;
if (isFun(f)) return TI(f, fn_ix)(f, w, x);
B fi = m1_d(incG(rt_undo), inc(f));
B r = c2(fi, w, x);
dec(fi);
return r;
}
B setInvReg_c1 (B t, B x) { rt_invFnReg = x; return inc(bi_nativeInvReg); } B setInvReg_c1 (B t, B x) { rt_invFnReg = x; return inc(bi_nativeInvReg); }
B setInvSwap_c1(B t, B x) { rt_invFnSwap = x; return inc(bi_nativeInvSwap); } B setInvSwap_c1(B t, B x) { rt_invFnSwap = x; return inc(bi_nativeInvSwap); }

View File

@ -230,7 +230,7 @@ void load_init() { // very last init function
/* ∧∨<>≠=≤≥≡≢ */ bi_and , bi_or , bi_lt , bi_gt , bi_ne , bi_eq , bi_le , bi_ge , bi_feq , bi_fne, /* ∧∨<>≠=≤≥≡≢ */ bi_and , bi_or , bi_lt , bi_gt , bi_ne , bi_eq , bi_le , bi_ge , bi_feq , bi_fne,
/* ⊣⊢⥊∾≍⋈↑↓↕« */ bi_ltack , bi_rtack , bi_shape , bi_join , bi_couple , bi_pair , bi_take , bi_drop , bi_ud , bi_shifta, /* ⊣⊢⥊∾≍⋈↑↓↕« */ bi_ltack , bi_rtack , bi_shape , bi_join , bi_couple , bi_pair , bi_take , bi_drop , bi_ud , bi_shifta,
/* »⌽⍉/⍋⍒⊏⊑⊐⊒ */ bi_shiftb , bi_reverse, bi_N , bi_slash, bi_gradeUp, bi_gradeDown, bi_select, bi_pick , bi_indexOf, bi_count, /* »⌽⍉/⍋⍒⊏⊑⊐⊒ */ bi_shiftb , bi_reverse, bi_N , bi_slash, bi_gradeUp, bi_gradeDown, bi_select, bi_pick , bi_indexOf, bi_count,
/* ∊⍷⊔!˙˜˘¨⌜⁼ */ bi_memberOf, bi_find , bi_group , bi_asrt , bi_const , bi_swap , bi_cell , bi_each , bi_tbl , bi_N, /* ∊⍷⊔!˙˜˘¨⌜⁼ */ bi_memberOf, bi_find , bi_group , bi_asrt , bi_const , bi_swap , bi_cell , bi_each , bi_tbl , bi_undo,
/* ´˝`∘○⊸⟜⌾⊘◶ */ bi_fold , bi_N , bi_scan , bi_atop , bi_over , bi_before , bi_after , bi_under, bi_val , bi_cond, /* ´˝`∘○⊸⟜⌾⊘◶ */ bi_fold , bi_N , bi_scan , bi_atop , bi_over , bi_before , bi_after , bi_under, bi_val , bi_cond,
/* ⎉⚇⍟⎊ */ bi_N , bi_N , bi_repeat, bi_catch /* ⎉⚇⍟⎊ */ bi_N , bi_N , bi_repeat, bi_catch
@ -240,7 +240,7 @@ void load_init() { // very last init function
/* ∧∨<>≠=≤≥≡≢ */ 1,1,1,1,1,1,1,1,1,1, /* ∧∨<>≠=≤≥≡≢ */ 1,1,1,1,1,1,1,1,1,1,
/* ⊣⊢⥊∾≍⋈↑↓↕« */ 1,1,1,1,1,1,1,1,1,1, /* ⊣⊢⥊∾≍⋈↑↓↕« */ 1,1,1,1,1,1,1,1,1,1,
/* »⌽⍉/⍋⍒⊏⊑⊐⊒ */ 1,1,0,1,1,1,1,1,1,1, /* »⌽⍉/⍋⍒⊏⊑⊐⊒ */ 1,1,0,1,1,1,1,1,1,1,
/* ∊⍷⊔!˙˜˘¨⌜⁼ */ 1,1,1,1,1,1,1,1,1,0, /* ∊⍷⊔!˙˜˘¨⌜⁼ */ 1,1,1,1,1,1,1,1,1,1,
/* ´˝`∘○⊸⟜⌾⊘◶ */ 1,0,1,1,1,1,1,1,1,1, /* ´˝`∘○⊸⟜⌾⊘◶ */ 1,0,1,1,1,1,1,1,1,1,
/* ⎉⚇⍟⎊ */ 0,0,1,1 /* ⎉⚇⍟⎊ */ 0,0,1,1
}; };