aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-08-23 07:20:55 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-08-23 07:20:55 -0400
commit68a6d369290859aa3188c79ed7d73db58e9ac234 (patch)
treedae4466db13ed0c9864f39c41e96efa7241d962c /spec
parentc8fd5abe3abad1251ce438d3dd3e640acde8990f (diff)
Specification for •MakeREPL, •state, and evaluation left arguments
Diffstat (limited to 'spec')
-rw-r--r--spec/system.md4
1 files changed, 4 insertions, 0 deletions
diff --git a/spec/system.md b/spec/system.md
index b7c9b911..1c70371c 100644
--- a/spec/system.md
+++ b/spec/system.md
@@ -15,8 +15,11 @@ All system values described in the BQN specification are optional: an implementa
| `•BQN` | Evaluate the argument string in an isolated scope
| `•Eval` | Evaluate the argument string in the current scope
| `•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
+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"`.
+
The effect of `•Eval` should be the same as if its argument were written as source code in the scope where `•Eval` appears. It can define variables, and modify those in the current scope or a parent.
`•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"`.
@@ -26,6 +29,7 @@ The effect of `•Eval` should be the same as if its argument were written as so
| Name | Summary
|------------|---------------------
| `•Import` | Load a script file
+| `•state` | `⟨•path, •name, •args⟩`
| `•args` | Arguments passed to current file
| `•path` | Current file's path
| `•name` | Current filename