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

@ -16,15 +16,16 @@
/*internal.c*/D(variation,"•internal.Variation") A(listVariations,"•internal.ListVariations") M(clearRefs,"•internal.ClearRefs") M(unshare,"•internal.Unshare")
#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 */ \
/*md1.c*/ A(timed,"•_timed")
/*md1.c*/A(timed,"•_timed")
#define FOR_PM2(A,M,D) \
/*md2.c*/ A(val,"") A(repeat,"") A(fillBy,"•_fillBy_") A(catch,"") \
/*md2.c*/ A(atop,"") A(over,"") A(before,"") A(after,"") A(cond,"") A(under,"") \
/*md2.c*/A(val,"") A(repeat,"") A(fillBy,"•_fillBy_") A(catch,"") \
/*md2.c*/A(atop,"") A(over,"") A(before,"") A(after,"") A(cond,"") A(under,"") \
/* everything before the definition of •_while_ is defined to be pure, and everything after is not */ \
/*md2.c*/ A(while,"•_while_")
/*md2.c*/A(while,"•_while_")
enum PrimNumbers {
/* +-×÷⋆√⌊⌈|¬ */ n_add , n_sub , n_mul , n_div , n_pow , n_root , n_floor , n_ceil , n_stile , n_not,

View File

@ -24,6 +24,21 @@ B fun_invSwap_c2(B t, B w, B 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 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_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_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_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,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,
/* ⎉⚇⍟⎊ */ 0,0,1,1
};