⋈
This commit is contained in:
parent
a663c0bbee
commit
dd3965cb3c
2
cc.bqn
2
cc.bqn
@ -38,7 +38,7 @@ _Lo ← {"B" MakeList 𝔽¨𝕩}
|
||||
glyphs ← Import "glyphs.bqn"
|
||||
_getComp ← { (4+2×useInd)↑ <∘⊢∾˜ 5↑ (𝕗 Import "c.bqn"){𝔽} }
|
||||
useInd ← "-i"≡⊑args ⋄ args↓˜↩useInd
|
||||
Comp ← ((<"inc(runtime["∾F∾"])"˙)¨↕62) glyphs _getComp ⊢
|
||||
Comp ← ((<"inc(runtime["∾F∾"])"˙)¨↕≠∾glyphs) glyphs _getComp ⊢
|
||||
J ← ∾∾⟜(@+10)¨
|
||||
|
||||
Fout ← {((≠𝕩)↑⟨Li ⋄ OAny _Lo ⋄ =◶⟨ONum,Li _Lo⟩ _Lo _Lo ⋄ (Li 2⊸↑) _Lo ⋄ Li _Lo ⋄ OStr⟩) {𝕎𝕩}¨ 𝕩}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
/* arith.c*/A(add,"+") A(sub,"-") A(mul,"×") A(div,"÷") A(pow,"⋆") A(root,"√") A(floor,"⌊") A(ceil,"⌈") A(stile,"|") A(eq,"=") \
|
||||
/* arith.c*/A(ne,"≠") D(le,"≤") D(ge,"≥") A(lt,"<") A(gt,">") A(and,"∧") A(or,"∨") A(not,"¬") A(log,"⋆⁼") \
|
||||
/* fns.c*/A(ud,"↕") A(fne,"≢") A(feq,"≡") A(ltack,"⊣") A(rtack,"⊢") 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,"⌽") \
|
||||
/* 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") \
|
||||
|
||||
@ -128,20 +128,20 @@ B shape_c2(B t, B w, B x) {
|
||||
}
|
||||
if (bad && !good) thrM("⥊: 𝕨 too large");
|
||||
if (unkPos!=-1) {
|
||||
if (unkInd!=52 & unkInd!=6 & unkInd!=30 & unkInd!=25) thrM("⥊: 𝕨 must consist of natural numbers or ∘ ⌊ ⌽ ↑");
|
||||
if (unkInd!=53 & unkInd!=6 & unkInd!=31 & unkInd!=26) thrM("⥊: 𝕨 must consist of natural numbers or ∘ ⌊ ⌽ ↑");
|
||||
if (nia==0) thrM("⥊: Can't compute axis when the rest of the shape is empty");
|
||||
i64 div = xia/nia;
|
||||
i64 mod = xia%nia;
|
||||
usz item;
|
||||
bool fill = false;
|
||||
if (unkInd == 52) {
|
||||
if (unkInd == 53) {
|
||||
if (mod!=0) thrM("⥊: Shape must be exact when reshaping with ∘");
|
||||
item = div;
|
||||
} else if (unkInd == 6) {
|
||||
item = div;
|
||||
} else if (unkInd == 30) {
|
||||
} else if (unkInd == 31) {
|
||||
item = mod? div+1 : div;
|
||||
} else if (unkInd == 25) {
|
||||
} else if (unkInd == 26) {
|
||||
item = mod? div+1 : div;
|
||||
fill = true;
|
||||
} else UD;
|
||||
|
||||
@ -63,7 +63,7 @@ B glyph_c1(B t, B x) {
|
||||
x = rtWrap_unwrap(x);
|
||||
#endif
|
||||
if (isPrim(x)) {
|
||||
B r = m_c32(U"+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!˙˜˘¨⌜⁼´˝`∘○⊸⟜⌾⊘◶⎉⚇⍟⎊"[v(x)->flags-1]);
|
||||
B r = m_c32(U"+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍⋈↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!˙˜˘¨⌜⁼´˝`∘○⊸⟜⌾⊘◶⎉⚇⍟⎊"[v(x)->flags-1]);
|
||||
dec(x);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ static B toConstant(B x) { // doesn't consume x
|
||||
if (v(x)->type == t_md1D) {
|
||||
Md1D* d = c(Md1D,x);
|
||||
B m1 = d->m1;
|
||||
if (v(m1)->type==t_md1BI && v(m1)->flags==44) return inc(d->f);
|
||||
if (v(m1)->type==t_md1BI && v(m1)->flags==45) return inc(d->f);
|
||||
}
|
||||
return bi_N;
|
||||
}
|
||||
|
||||
2
src/h.h
2
src/h.h
@ -71,7 +71,7 @@
|
||||
#undef CATCH_ERRORS
|
||||
#endif
|
||||
|
||||
#define rtLen 63
|
||||
#define rtLen 64
|
||||
|
||||
#if CATCH_ERRORS
|
||||
#define PROPER_FILLS (EACH_FILLS&SFNS_FILLS)
|
||||
|
||||
63
src/load.c
63
src/load.c
@ -224,22 +224,23 @@ void load_init() { // very last init function
|
||||
comp_currSrc = bi_N;
|
||||
gc_addFn(load_gcFn);
|
||||
B fruntime[] = {
|
||||
/* +-×÷⋆√⌊⌈|¬ */ bi_add , bi_sub , bi_mul , bi_div , bi_pow , bi_root , bi_floor, bi_ceil , bi_stile , bi_not,
|
||||
/* ∧∨<>≠=≤≥≡≢ */ 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_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_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_add , bi_sub , bi_mul , bi_div , bi_pow , bi_root , bi_floor , bi_ceil , bi_stile , bi_not,
|
||||
/* ∧∨<>≠=≤≥≡≢ */ 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_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
|
||||
|
||||
};
|
||||
bool rtComplete[] = {
|
||||
/* +-×÷⋆√⌊⌈|¬ */ 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,1,1,1,1,1,1,1,0,1,
|
||||
/* ˝`∘○⊸⟜⌾⊘◶⎉ */ 0,1,1,1,1,1,1,1,1,0,
|
||||
/* ⚇⍟⎊ */ 0,1,1
|
||||
/* ⊣⊢⥊∾≍⋈↑↓↕« */ 1,1,1,1,1,0,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,0,1,1,1,1,1,1,1,1,
|
||||
/* ⎉⚇⍟⎊ */ 0,0,1,1
|
||||
};
|
||||
assert(sizeof(fruntime)/sizeof(B) == rtLen);
|
||||
for (u64 i = 0; i < rtLen; i++) inc(fruntime[i]);
|
||||
@ -248,7 +249,7 @@ void load_init() { // very last init function
|
||||
#ifndef NO_RT
|
||||
B provide[] = {bi_type,bi_fill,bi_log,bi_grLen,bi_grOrd,bi_asrt,bi_add,bi_sub,bi_mul,bi_div,bi_pow,bi_floor,bi_eq,bi_le,bi_fne,bi_shape,bi_pick,bi_ud,bi_tbl,bi_scan,bi_fillBy,bi_val,bi_catch};
|
||||
#ifndef ALL_R0
|
||||
B runtime_0[] = {bi_floor,bi_ceil,bi_stile,bi_lt,bi_gt,bi_ne,bi_ge,bi_rtack,bi_ltack,bi_join,bi_take,bi_drop,bi_select,bi_const,bi_swap,bi_each,bi_fold,bi_atop,bi_over,bi_before,bi_after,bi_cond,bi_repeat};
|
||||
B runtime_0[] = {bi_floor,bi_ceil,bi_stile,bi_lt,bi_gt,bi_ne,bi_ge,bi_rtack,bi_ltack,bi_join,bi_pair,bi_take,bi_drop,bi_select,bi_const,bi_swap,bi_each,bi_fold,bi_atop,bi_over,bi_before,bi_after,bi_cond,bi_repeat};
|
||||
#else
|
||||
Block* runtime0_b = load_compImport(
|
||||
#include "gen/runtime0"
|
||||
@ -274,22 +275,22 @@ void load_init() { // very last init function
|
||||
HArr_p runtimeH = m_harrUc(rtObjRaw);
|
||||
SGet(rtObjRaw)
|
||||
|
||||
rt_undo = Get(rtObjRaw, 48); gc_add(rt_undo);
|
||||
rt_select = Get(rtObjRaw, 35); gc_add(rt_select);
|
||||
rt_slash = Get(rtObjRaw, 32); gc_add(rt_slash);
|
||||
rt_undo = Get(rtObjRaw, 49); gc_add(rt_undo);
|
||||
rt_select = Get(rtObjRaw, 36); gc_add(rt_select);
|
||||
rt_slash = Get(rtObjRaw, 33); gc_add(rt_slash);
|
||||
rt_join = Get(rtObjRaw, 23); gc_add(rt_join);
|
||||
rt_ud = Get(rtObjRaw, 27); gc_add(rt_ud);
|
||||
rt_pick = Get(rtObjRaw, 36); gc_add(rt_pick);
|
||||
rt_take = Get(rtObjRaw, 25); gc_add(rt_take);
|
||||
rt_drop = Get(rtObjRaw, 26); gc_add(rt_drop);
|
||||
rt_group = Get(rtObjRaw, 41); gc_add(rt_group);
|
||||
rt_under = Get(rtObjRaw, 56); gc_add(rt_under);
|
||||
rt_reverse = Get(rtObjRaw, 30); gc_add(rt_reverse);
|
||||
rt_indexOf = Get(rtObjRaw, 37); gc_add(rt_indexOf);
|
||||
rt_count = Get(rtObjRaw, 38); gc_add(rt_count);
|
||||
rt_memberOf= Get(rtObjRaw, 39); gc_add(rt_memberOf);
|
||||
rt_find = Get(rtObjRaw, 40); gc_add(rt_find);
|
||||
rt_cell = Get(rtObjRaw, 45); gc_add(rt_cell);
|
||||
rt_ud = Get(rtObjRaw, 28); gc_add(rt_ud);
|
||||
rt_pick = Get(rtObjRaw, 37); gc_add(rt_pick);
|
||||
rt_take = Get(rtObjRaw, 26); gc_add(rt_take);
|
||||
rt_drop = Get(rtObjRaw, 27); gc_add(rt_drop);
|
||||
rt_group = Get(rtObjRaw, 42); gc_add(rt_group);
|
||||
rt_under = Get(rtObjRaw, 57); gc_add(rt_under);
|
||||
rt_reverse = Get(rtObjRaw, 31); gc_add(rt_reverse);
|
||||
rt_indexOf = Get(rtObjRaw, 38); gc_add(rt_indexOf);
|
||||
rt_count = Get(rtObjRaw, 39); gc_add(rt_count);
|
||||
rt_memberOf= Get(rtObjRaw, 40); gc_add(rt_memberOf);
|
||||
rt_find = Get(rtObjRaw, 41); gc_add(rt_find);
|
||||
rt_cell = Get(rtObjRaw, 46); gc_add(rt_cell);
|
||||
|
||||
for (usz i = 0; i < rtLen; i++) {
|
||||
#ifdef RT_WRAP
|
||||
@ -342,12 +343,12 @@ void load_init() { // very last init function
|
||||
print_allocStats();
|
||||
exit(0);
|
||||
#else // use compiler
|
||||
B prevAsrt = runtime[42];
|
||||
runtime[42] = bi_casrt; // horrible but GC is off so it's fiiiiiine
|
||||
B prevAsrt = runtime[43];
|
||||
runtime[43] = bi_casrt; // horrible but GC is off so it's fiiiiiine
|
||||
Block* comp_b = load_compImport(
|
||||
#include "gen/compiler"
|
||||
);
|
||||
runtime[42] = prevAsrt;
|
||||
runtime[43] = prevAsrt;
|
||||
load_comp = m_funBlock(comp_b, 0); ptr_dec(comp_b);
|
||||
gc_add(load_comp);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user