diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-08-23 21:47:50 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-08-23 21:47:50 -0400 |
| commit | 797ac909fe0e34ec3408164c789203edfea0d55b (patch) | |
| tree | 4ebb9e4de065f45eb253c5e59362e45b12bd0c2a /spec | |
| parent | 479974d584a44967a5a3fd69e439ec2fed3dd292 (diff) | |
Draft •NewBQN spec
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/system.md | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/system.md b/spec/system.md index 1c70371c..c003cdb5 100644 --- a/spec/system.md +++ b/spec/system.md @@ -17,6 +17,7 @@ All system values described in the BQN specification are optional: an implementa | `•ScopedEval` | Evaluate the argument string in a child scope | `•MakeREPL` | Create an evaluator that keeps variables across runs | `•Using` | Import all values from the argument namespace +| `•NewBQN` | Create a BQN-like evaluation function with options `𝕩` The left argument to any evaluator (`•BQN`, `•Eval`, `•ScopedEval`, result of `•MakeREPL`), if given, is a list of up to three elements, giving a prefix of `•state` (see next section) during evaluations of that function. Thus `⟨"","xyz"⟩•BQN"•name"` returns `"xyz"`. @@ -24,6 +25,17 @@ The effect of `•Eval` should be the same as if its argument were written as so `•ScopedEval` creates as new scope for evaluation as it is loaded. Other than its syntactic role, it is effectively equivalent to `{•Eval}`. Parent scopes are visible from the created scope; to make a scope without this property use `•BQN"•Eval"` or `•BQN"•ScopedEval"`. +`•NewBQN` accepts a namespace `𝕩`. The following options are specified if supported: + +| Option | Values (default first) +|---------------|-------------------------- +| `repl` | `"none"`, `"strict"`, `"loose"` +| `scope` | `"none"`, `"read"`, `"modify"` +| `primitives` | List of glyph-value pairs; default `⟨⟩` +| `retain` | `"all"`, `"unique"`, `"none"` + +The option `repl` indicates how variables are retained across calls: with "none" they are not saved; with "strict", they are saved and can't be redefined; and with "loose" they may be redefined. `scope` indicates allowed interaction with the scope in which `•NewBQN` is *called* (not loaded): with "read" variables may be read and with "modify" they may be read or modified. `primitives` indicates primitives to be added in this copy of BQN. Each primitive uses the glyph and value given. The value must have an operation type and its type determines the primitive's role. `retain` indicates which primitives from the current running BQN should be kept. With "all", an error is given if `primitives` redefines an existing primitive, but with "unique" primitives may be redefined. + ## Scripts | Name | Summary |
