new cc.bqn

This commit is contained in:
dzaima 2021-04-26 10:04:32 +03:00
parent b5468f630b
commit 776a77f033
3 changed files with 13 additions and 8 deletions

14
cc.bqn
View File

@ -28,9 +28,9 @@ FChars ← {𝕨•FChars path∾𝕩}
FLines {𝕨•FLines path𝕩}
glyphs Import "glyphs.bqn"
compile glyphs Import "c.bqn"
_getComp { (3+useInd) (𝕗 Import "c.bqn"){𝔽} }
useInd "-i"args args˜useInd
Comp (3+useInd) ((<"inc(runtime[""])"˙)¨62)Compile
Comp ((<"inc(runtime[""])"˙)¨62) glyphs _getComp
J \n¨
Fconst @NumChar, Str,
prov {"inc("𝕩")"}¨"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"
@ -38,15 +38,19 @@ Fout ← {((≠𝕩)↑⟨LI F¨,L ·prov⊸∾⍟(𝕨⊣0) Fconst¨,L (LI F¨)
Frun 1Fout
Long {¯2𝕩¨<","\n}
LFC LongFoutComp
RT {𝕩
primsrefImport"pr.bqn" lprims
Long Frun l(1) (l) prims _getComp ref
}
CArg {J (¯5𝕩˙) FLines "c.bqn"}
LFC LongFoutComp
•Out(¬return) ("r""c""cc""f""e""p")
{𝕩reflenImport "pr.bqn"Long Frun len(1)Comp ref}
RT
{𝕩LFC CArg "⟨""⟩"«","¨'"'(˜)¨glyphs}
{𝕩LFC "{""}"˜CArg"𝕩"}
{𝕩LFC FChars "f.bqn"}
{𝕩LFC SVG "e"}
{𝕩LFC SVG "p"}
¯1 · J LFoutComp¨
args
args

View File

@ -346,6 +346,7 @@ usz o2s (B x) { if ((usz)x.f!=x.f) thrM("Expected integer"); return (usz)x.f;
i64 o2i64 (B x) { if ((i64)x.f!=x.f) thrM("Expected integer"); return (i64)x.f; }
f64 o2f (B x) { if (!isNum(x)) thrM("Expected integer"); return x.f; }
i32 o2iu (B x) { return isI32(x)? (i32)(u32)x.u : (i32)x.f; }
usz o2su (B x) { return (usz)x.f; }
i64 o2i64u(B x) { return (i64)x.f; }
bool q_i32(B x) { return isI32(x) || isF64(x)&(x.f==(i32)x.f); }

View File

@ -171,10 +171,10 @@ B pick_c1(B t, B x) {
return r;
}
B pick_c2(B t, B w, B x) {
usz wu = o2s(w);
if (!isArr(x)) { dec(x); dec(w); thrM("⊑: 𝕩 wasn't an array"); }
// usz wu = o2s(w);
// if (!isArr(x)) { dec(x); dec(w); thrM("⊑: 𝕩 wasn't an array"); }
// if (wu >= a(x)->ia) err("⊑: 𝕨 is greater than length of 𝕩"); // no bounds check for now
B r = TI(x).get(x, wu);
B r = TI(x).get(x, o2su(w));
dec(x);
return r;
}