add •Fmt, changes to readme files

This commit is contained in:
dzaima 2021-08-27 11:52:56 +03:00
parent a7ee8044d1
commit 305f578707
4 changed files with 18 additions and 8 deletions

View File

@ -3,12 +3,13 @@ Build & run (tl;dr: `make; rlwrap ./BQN`):
1. (optional) Run `./genRuntime path/to/mlochbaum/BQN`; Otherwise, the necessary precompiled bytecode will be retrieved from `remotes/origin/bytecode`
2. If wanted, customize settings in `src/h.h`
3. `make`
- Options: `make o3`, `make debug` (`make rtperf`, `make heapverify` and `make rtverify` also exist for further testing/debugging)
- Do `make clean` or `make [o3|debug|…]-clean` beforehand to force recompile
- `./build` and `./debugBuild` compile everything at once and allow specifying extra compiler arguments, but may be slower
4. `./BQN` (or `rlwrap ./BQN` for a better REPL)
- Options: `make o3` (the default), `make debug` (more presets exist for more specific debugging)
- `make CC=gcc` can be used to compile with gcc
- Do `make clean` or `make t=[o3|debug|…] clean` beforehand to force recompile
- `make single-(o3|o3g|debug|c)` compile everything as a single translation unit and thus will compile slower, but allows specifying extra compiler arguments with `make f='…' single-…` and allows the compiler to optimize more
4. `./BQN` (or `rlwrap ./BQN` for a better REPL; see `./BQN --help` for more options)
Run tests with `./BQN mlochbaum/BQN/test/this.bqn` (with `-noerr` for a heapverify build).
Run tests with `./BQN mlochbaum/BQN/test/this.bqn` (add `-noerr` for a heapverify build).
Time REPL-executed safe prim tests: `./test.bqn mlochbaum/BQN -s prim > SP; time ./BQN<SP>/dev/null`

View File

@ -6,7 +6,7 @@ Functions starting with `m_` allocate a new object.
Functions starting with `q_` are queries/predicates, and return a boolean.
Functions ending with `R` are either supposed to be called rarely, or the caller expects that a part of it happens rarely.
Functions ending with `U` return (or take) a non-owned object (`U` = "unincremented").
Functions ending with `_c1` are monadic implementations, `_c2` are dyadic (for both modifiers and functions).
Functions ending with `_c1` are monadic implementations, `_c2` are dyadic (for both modifiers and functions).
Variables starting with `bi_` are builtins (primitives or special values).
Which arguments are consumed usually is described in a comment after the function or its prototype. Otherwise, check the source.

View File

@ -75,11 +75,19 @@ B repr_c1(B t, B x) {
#if FORMATTER
return bqn_repr(x);
#else
thrM("•Repr: Cannot represent non-numbers");
thrM("•Repr: Cannot represent non-numbers without FORMATTER defined");
#endif
}
}
B fmt_c1(B t, B x) {
#if FORMATTER
return bqn_fmt(x);
#else
thrM("•Fmt isn't supported without FORMATTER defined");
#endif
}
B fill_c1(B t, B x) {
B r = getFillE(x);
dec(x);
@ -660,6 +668,7 @@ B sys_c1(B t, B x) {
else if (eqStr(c, U"delay")) r.a[i] = inc(bi_delay);
else if (eqStr(c, U"hash")) r.a[i] = inc(bi_hash);
else if (eqStr(c, U"repr")) r.a[i] = inc(bi_repr);
else if (eqStr(c, U"fmt")) r.a[i] = inc(bi_fmt);
else if (eqStr(c, U"glyph")) r.a[i] = inc(bi_glyph);
else if (eqStr(c, U"makerand")) r.a[i] = inc(bi_makeRand);
else if (eqStr(c, U"makerepl")) r.a[i] = inc(bi_makeREPL);

View File

@ -8,7 +8,7 @@
/* 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") \
/* sysfn.c*/M(repr,"•Repr") A(asrt,"!") A(casrt,"!") M(out,"•Out") M(show,"•Show") M(bqn,"•BQN") M(sh,"•SH") M(fromUtf8,"•FromUTF8") \
/* sysfn.c*/M(repr,"•Repr") M(fmt,"•Fmt") A(asrt,"!") A(casrt,"!") M(out,"•Out") M(show,"•Show") M(bqn,"•BQN") M(sh,"•SH") M(fromUtf8,"•FromUTF8") \
/* sysfn.c*/D(cmp,"•Cmp") A(hash,"•Hash") M(delay,"•Delay") M(makeRand,"•MakeRand") M(makeREPL,"•MakeREPL") M(exit,"•Exit") M(getLine,"•GetLine") \
/*internal.c*/M(itype,"•internal.Type") M(refc,"•internal.Refc") M(squeeze,"•internal.Squeeze") M(isPure,"•internal.IsPure") A(info,"•internal.Info") \
/*internal.c*/D(variation,"•internal.Variation") A(listVariations,"•internal.ListVariations") M(clearRefs,"•internal.ClearRefs") M(unshare,"•internal.Unshare")