diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-06-08 22:25:20 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-06-08 22:25:20 -0400 |
| commit | 7733b104e3eff841dcd1ac3f67731eb80746e427 (patch) | |
| tree | a49f1190234df28c4355eb2408f3f4c0d31c7568 /docs/doc/types.html | |
| parent | bed78fe6147cb7921b7367960d406d28d37cb019 (diff) | |
Add page on function and modifier types
Diffstat (limited to 'docs/doc/types.html')
| -rw-r--r-- | docs/doc/types.html | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/doc/types.html b/docs/doc/types.html index 20ab9578..c27a9400 100644 --- a/docs/doc/types.html +++ b/docs/doc/types.html @@ -63,6 +63,7 @@ <p>Arrays are value types (or immutable), so that there is no way to "change" the shape or elements of an array. An array with different properties is a different array. As a consequence, arrays are an inductive type, and it's not possible for an array to contain itself, or contain an array that contains itself, and so on. However, it is possible for an array to contain a function or other operation that has access to the array through a variable, and in this sense an array can "know about" itself.</p> <p>Different elements of an array should not influence each other. While some APLs force numbers placed in the same array to a common representation, which may have different precision properties, BQN values must not change behavior when placed in an array. However, this doesn't preclude changing the storage type of an array for better performance: for example, in a BQN implementation using 64-bit floats, an array whose elements are all integers that fit in 32-bit int range might be represented as an array of 32-bit ints.</p> <h2 id="operation-types"><a class="header" href="#operation-types">Operation types</a></h2> +<p><em>Full documentation <a href="ops.html">here</a>.</em></p> <p>An operation is either a function or modifier, and can be applied to <em>inputs</em>—which are called <em>arguments</em> for functions and <em>operands</em> for modifiers—to obtain a result. During this application an operation might also change variables within its scope and call other operations, or cause an error, in which case it doesn't return a result. There is one type of call for each of the three operation types, and an operation will give an error if it is called in a way that doesn't match its type.</p> <p>In BQN syntax the result of a function has a subject role and the result of a modifier has a function role. However, the result can be any value at all: roles take place at the syntactic level, which has no bearing on types and values in the semantic level. This distinction is discussed further in <a href="context.html#mixing-roles">Mixing roles</a>.</p> <h3 id="functions"><a class="header" href="#functions">Functions</a></h3> @@ -70,4 +71,5 @@ <h3 id="modifiers"><a class="header" href="#modifiers">Modifiers</a></h3> <p>A 1-modifier is called with one operand, while a 2-modifier is called with two. In contrast to functions, these are distinct types, and it is impossible to have a value that can be called with either one or two operands. Also in contrast to functions, data values cannot be called as modifiers: they will cause an error if called this way.</p> <h2 id="namespaces"><a class="header" href="#namespaces">Namespaces</a></h2> -<p>Functions and modifiers have internal scopes which they can manipulate (by defining and modifying variables) to save and update information. Namespaces let the programmer to expose this state more directly: identifiers in a namespace may be exported, allowing code outside the namespace to read their values. They are described in detail <a href="namespace.html">here</a>.</p> +<p><em>Full documentation <a href="namespace.html">here</a>.</em></p> +<p>Functions and modifiers have internal scopes which they can manipulate (by defining and modifying variables) to save and update information. Namespaces let the programmer to expose this state more directly: identifiers in a namespace may be exported, allowing code outside the namespace to read their values.</p> |
