aboutsummaryrefslogtreecommitdiff
path: root/implementation/vm.md
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-12-31 12:45:01 -0500
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-12-31 12:45:01 -0500
commitfdd35b10d11a1a0fe20634054ee46e2091c44b24 (patch)
tree9cde885cabc0371033d4022ab408c85c138c0f25 /implementation/vm.md
parentb3ee81ff8c05a876a953ec1715fa3cc9856a57ed (diff)
Document runtime's SetInv function
Diffstat (limited to 'implementation/vm.md')
-rw-r--r--implementation/vm.md2
1 files changed, 2 insertions, 0 deletions
diff --git a/implementation/vm.md b/implementation/vm.md
index 89f2ef17..e6264e5b 100644
--- a/implementation/vm.md
+++ b/implementation/vm.md
@@ -212,6 +212,8 @@ The contents of a core runtime are given below. The names given are those used i
To define the final two functions, call the second returned element as a function, with argument `Decompose‿PrimInd`. The function `PrimInd` gives the index of `𝕩` in the list of all primitives (defined as `glyphs` in pr.bqn), or the length of the runtime if `𝕩` is not a primitive. The two functions are only needed for computing inferred properties, and are defined by default so that every value is assumed to be a primitive, and `PrimInd` performs a linear search over the returned runtime. If the runtime is used directly, then this means that without setting `Decompose‿PrimInd`, function inferred properties will work slowly and for primitives only; if values from the runtime are wrapped then function inferred properties will not work at all. The compiler uses Under with compound right operands, so `Decompose` is needed to self-host.
+The compiler returns a third function `SetInv` as well. This function is used to support inverses of non-primitives like `•math.Sin` or a block with an Undo header that the runtime has no way to identify. It's not needed for the runtime or compiler. The argument `𝕩` is a function that takes the runtime's current `Inverse` function (`⁼` is defined as `{i←Inverse𝕗⋄𝕨I𝕩}`) and returns a new one. If given, `𝕨` does the same to `SwapInverse`, the function that inverts `Fn˜`. The result of `SetInv` is the new `Inverse` function.
+
Remember that `+` and `-` can also work on characters in some circumstances, under the rules of affine characters. Other arithmetic functions should only accept numbers. `=` must work on any atoms including functions and modifiers. `≤` must work on numbers and characters.
### GroupLen and GroupOrd