From 797ac909fe0e34ec3408164c789203edfea0d55b Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Mon, 23 Aug 2021 21:47:50 -0400 Subject: =?UTF-8?q?Draft=20=E2=80=A2NewBQN=20spec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/spec/system.html | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'docs/spec/system.html') diff --git a/docs/spec/system.html b/docs/spec/system.html index d4b56cf4..64200f27 100644 --- a/docs/spec/system.html +++ b/docs/spec/system.html @@ -37,11 +37,43 @@ •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".

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".

+

•NewBQN accepts a namespace 𝕩. The following options are specified if supported:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
OptionValues (default first)
repl"none", "strict", "loose"
scope"none", "read", "modify"
primitivesList 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

-- cgit v1.2.3