diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-08-31 22:02:40 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-08-31 22:04:19 -0400 |
| commit | 85bd95ab4f2a40ccb1de042eaca64b9383a901ae (patch) | |
| tree | c391cc3ee2fb9a1bd0f4fc8df30a8b4dd6b3b99b /docs/doc/syntax.html | |
| parent | ff0865870036fa767a041169cfd90243c52ec03b (diff) | |
Docs on the blocks
Diffstat (limited to 'docs/doc/syntax.html')
| -rw-r--r-- | docs/doc/syntax.html | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/docs/doc/syntax.html b/docs/doc/syntax.html index c37f0db1..42fe714a 100644 --- a/docs/doc/syntax.html +++ b/docs/doc/syntax.html @@ -42,7 +42,7 @@ </tr> <tr> <td><code><span class='Gets'>→</span></code></td> -<td>Return</td> +<td><a href="block.html#returns">Return</a></td> </tr> <tr> <td><code><span class='Separator'>⋄,</span></code> or newline</td> @@ -62,11 +62,11 @@ </tr> <tr> <td><code><span class='Value'>:</span></code></td> -<td>Block header</td> +<td><a href="block.html#block-headers">Block header</a></td> </tr> <tr> <td><code><span class='Value'>;</span></code></td> -<td>Block body separator</td> +<td><a href="block.html#multiple-bodies">Block body separator</a></td> </tr> <tr> <td><code><span class='Value'>𝕨</span><span class='Function'>𝕎</span></code></td> @@ -147,6 +147,7 @@ <p>Lists (1-dimensional arrays) are enclosed in angle brackets <code><span class='Bracket'>⟨⟩</span></code>, with the results of the expressions in between being the list's elements. Lists of two elements or more can also be written with the ligature character <code><span class='Ligature'>‿</span></code>. This character has higher binding strength than any part of an expression. If one of the elements is a compound expression, then it will need to be enclosed in parentheses.</p> <p>If added, <a href="extensions.html#sets-and-dictionaries">sets and dictionaries</a> would also use a list-like notation.</p> <h3 id="blocks">Blocks</h3> +<p><em><a href="block.html">Full documentation</a></em></p> <p>Blocks are written with curly braces <code><span class='Brace'>{}</span></code> and can be used to group expressions or define functions and modifiers. The contents are simply a sequence of expressions, where each is evaluated and the result of the last is returned in order to evaluate the block. This result can have any value, and its syntactic role in the calling context is determined by the normal rules: functions return subjects and modifiers return functions. Blocks have lexical scope.</p> <p>The special names <code><span class='Value'>𝕨</span></code> and <code><span class='Value'>𝕩</span></code>, which stand for arguments, and <code><span class='Value'>𝕗</span></code> and <code><span class='Value'>𝕘</span></code>, which stand for operands, are available inside curly braces. Like ordinary names, the lowercase forms indicate subjects and the uppercase forms <code><span class='Function'>𝕎𝕏𝔽𝔾</span></code> indicate functions. The type and syntactic role of the block is determined by its contents: a 2-modifier contains <code><span class='Value'>𝕘</span></code>, a 1-modifier contains <code><span class='Value'>𝕗</span></code> but not <code><span class='Value'>𝕘</span></code>, and a function contains neither but does have one of <code><span class='Value'>𝕨𝕩𝕤</span><span class='Function'>𝕎𝕏𝕊</span></code>. If no special names are present the block is an <em>immediate block</em> and is evaluated as soon as it appears, with the result having a subject role.</p> <p>A modifier can be evaluated twice: once when passed operands and again when the resulting function is passed arguments. If it contains <code><span class='Value'>𝕨</span></code> or <code><span class='Value'>𝕩</span></code>, the first evaluation simply remembers the operands, and the contents will be executed only on the second evaluation, when the arguments are available. If it doesn't contain these, then the contents are executed on the first evaluation and the result is treated as a function.</p> |
