diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-07-23 22:49:20 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-07-23 22:49:20 -0400 |
| commit | a717221a7dd2fb88ff9d5d07e221a83dc558b47d (patch) | |
| tree | 0b3ceb6ca130ea5f9dccd706ddb72368a71bd924 | |
| parent | 4cc1cb8d7b34eb99d77fd35a53797e6929b348f7 (diff) | |
Update list notation links
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | doc/arrayrepr.md | 2 | ||||
| -rw-r--r-- | doc/context.md | 2 | ||||
| -rw-r--r-- | doc/control.md | 2 | ||||
| -rw-r--r-- | doc/fromDyalog.md | 2 | ||||
| -rw-r--r-- | doc/fromJ.md | 2 | ||||
| -rw-r--r-- | doc/glossary.md | 2 | ||||
| -rw-r--r-- | doc/syntax.md | 4 | ||||
| -rw-r--r-- | docs/doc/arrayrepr.html | 1 | ||||
| -rw-r--r-- | docs/doc/context.html | 2 | ||||
| -rw-r--r-- | docs/doc/control.html | 2 | ||||
| -rw-r--r-- | docs/doc/fromDyalog.html | 2 | ||||
| -rw-r--r-- | docs/doc/fromJ.html | 2 | ||||
| -rw-r--r-- | docs/doc/syntax.html | 3 | ||||
| -rw-r--r-- | docs/index.html | 2 |
15 files changed, 19 insertions, 13 deletions
@@ -35,7 +35,7 @@ It incorporates concepts developed over years of APL practice: * Lightweight [**anonymous functions**](doc/block.md) (like [dfns](https://aplwiki.com/wiki/Dfn)) borrow some power from Lisp. But BQN is redesigned from the ground up, with brand new ideas to make these paradigms easier to use and less likely to fail. -* The [**based array model**](doc/based.md) eliminates the surprise of floating arrays and the hassle of explicit boxes, while dedicated [**list notation**](tutorial/list.md#list-notation) does away with [stranding](https://aplwiki.com/wiki/Strand_notation) gotchas. +* The [**based array model**](doc/based.md) eliminates the surprise of floating arrays and the hassle of explicit boxes, while dedicated [**list notation**](doc/arrayrepr.md#list-literals) does away with [stranding](https://aplwiki.com/wiki/Strand_notation) gotchas. * [**Context-free grammar**](doc/context.md) makes it easier for machines and humans to understand code, and naturally leads to [**first-class functions**](doc/functional.md), which can even be used to [reinvent control structures](doc/control.md). * [**New symbols**](keymap.md) for built-in functionality make the syntactic role of every primitive instantly visible, and aim to be more consistent and intuitive. * No-nonsense [**namespace syntax**](doc/namespace.md) encapsulates data and even allows for a little [object-oriented programming](doc/oop.md). diff --git a/doc/arrayrepr.md b/doc/arrayrepr.md index b8264704..74e8426e 100644 --- a/doc/arrayrepr.md +++ b/doc/arrayrepr.md @@ -86,6 +86,8 @@ This case also covers empty lists, which are shown as `⟨⟩`. This includes an ## List literals +*The tutorial section [here](../tutorial/list.md#list-notation) also covers this topic.* + There are three kinds literal notation for lists: strings, list notation, and stranding. Strings indicate character lists (with space for the fill) and the other two can combine any sequence of elements. ### Strings diff --git a/doc/context.md b/doc/context.md index 516a5f18..15a32b2b 100644 --- a/doc/context.md +++ b/doc/context.md @@ -48,7 +48,7 @@ One rule for typing is also best considered to be a pre-parsing rule like the sp ## BQN's grammar -A formal treatment is included in [the spec](../spec/grammar.md). BQN's grammar—the ways syntactic roles interact—follows the original APL model (plus trains) closely, with allowances for new features like list notation. In order to keep BQN's syntax context-free, the syntactic role of any expression must be known from its contents, just like tokens. +A formal treatment is included in [the spec](../spec/grammar.md). BQN's grammar—the ways syntactic roles interact—follows the original APL model (plus trains) closely, with allowances for new features like [list notation](arrayrepr.md#list-literals). In order to keep BQN's syntax context-free, the syntactic role of any expression must be known from its contents, just like tokens. Here is a table of the APL-derived modifier and function application rules: diff --git a/doc/control.md b/doc/control.md index d3b47d29..80e3159b 100644 --- a/doc/control.md +++ b/doc/control.md @@ -228,7 +228,7 @@ Very well… a for loop is just a while loop with some extra pre- and post-actio The initialization can be a simple expression as shown; in fact it's a little silly to make initialization one of the arguments to `For` at all.Unlike in C, it's impossible to declare a variable that's local to the whole `For` loop but not its surroundings. Hopefully this is obvious from the structure of the code! Only curly braces can create a new scope, so to localize some variables in the `For` loop, just surround it in an extra set of curly braces. -The `While` loop alone allows syntax similar to the `For` loop. Perform any initialization outside of the loop, and compose the post-action with the main body using the reverse composition `{𝔾∘𝔽}`. Because the composition binds less tightly than stranding, the bracketed list notation has to be used here. +The `While` loop alone allows syntax similar to the `For` loop. Perform any initialization outside of the loop, and compose the post-action with the main body using the reverse composition `{𝔾∘𝔽}`. Because the composition binds less tightly than stranding, the bracketed [list notation](arrayrepr.md#brackets) has to be used here. c←27 ⋄ n←0 While ⟨{𝕤⋄1<c}, {𝕤⋄n+↩1}{𝔾∘𝔽}{𝕤 diff --git a/doc/fromDyalog.md b/doc/fromDyalog.md index 71a61b48..edc6a3d7 100644 --- a/doc/fromDyalog.md +++ b/doc/fromDyalog.md @@ -51,7 +51,7 @@ BQN doesn't have guards: it uses modifiers or [control structures](control.md) i The assignment arrow `←` defines a new variable in a block, while `↩` modifies an existing one. -BQN uses the ligature character `‿` for stranding, instead of plain juxtaposition. It also has a [list notation](syntax.md#list-notation) using `⟨⟩`. +BQN uses the ligature character `‿` for stranding, instead of plain juxtaposition. It also has a [list notation](arrayrepr.md#brackets) using `⟨⟩`. ## For reading diff --git a/doc/fromJ.md b/doc/fromJ.md index 3e1abbce..6363420b 100644 --- a/doc/fromJ.md +++ b/doc/fromJ.md @@ -45,7 +45,7 @@ In J, the part of speech is an inherent property of a value, while in BQN it is | `[:` | `·` | Cap | `assert.` | `!` | -BQN's explicit functions and modifiers are called "blocks", and have a more sophisticated syntax than J; see [the documentation](block.md). BQN uses [lexical scope](lexical.md), and has no global variables. BQN also has a [list notation](syntax.md#list-notation) using `⟨⟩`. +BQN's explicit functions and modifiers are called "blocks", and have a more sophisticated syntax than J; see [the documentation](block.md). BQN uses [lexical scope](lexical.md), and has no global variables. BQN also has a [list notation](arrayrepr.md#brackets) using `⟨⟩`. ## For reading diff --git a/doc/glossary.md b/doc/glossary.md index 9fd9a568..a3389e3f 100644 --- a/doc/glossary.md +++ b/doc/glossary.md @@ -108,7 +108,7 @@ The possible roles are: * **Nothing**: A special value-like entity that comes from `·`, `𝕨` in a function with no left argument, or a function called on nothing. * **Statement**: An expression, or nothing (`·`). * **Ligature**: The character `‿`. -* [**List notation**](syntax.md#list-notation): The angle brackets `⟨⟩` or ligatures used to indicate a list. +* [**List notation**](arrayrepr.md#brackets): The angle brackets `⟨⟩` or ligatures used to indicate a list. ## Assignment and scoping diff --git a/doc/syntax.md b/doc/syntax.md index 61ea0114..76489695 100644 --- a/doc/syntax.md +++ b/doc/syntax.md @@ -72,7 +72,7 @@ BQN's built-in operations also have patterns to indicate the syntactic role: 1-m ### Assignment -Another element that can be included in expressions is assignment, which is written with `←` to *define* (also called "declare" in many other languages) a variable and `↩` to *change* its definition. A variable can only be defined once within a scope, and can only be changed if it has already been defined. However, it can be shadowed, meaning that it is defined again in an inner scope even though it has a definition in an outer scope already. +Another element that can be included in expressions is assignment, which is written with `←` to *define* (also called "declare" in many other languages) a variable and `↩` to *change* its definition. A variable can only be defined once within a [scope](lexical.md), and can only be changed if it has already been defined. However, it can be shadowed, meaning that it is defined again in an inner scope even though it has a definition in an outer scope already. x←1 ⋄ {x←2 ⋄ x↩3 ⋄ x} x @@ -103,6 +103,8 @@ The characters `⋄` and `,` and newline are completely interchangeable and are ### List notation +*[Full documentation](arrayrepr.md#list-literals)* + Lists (1-dimensional arrays) are enclosed in angle brackets `⟨⟩`, 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 `‿`. 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. ### Blocks diff --git a/docs/doc/arrayrepr.html b/docs/doc/arrayrepr.html index aee3ce4a..fa2332c6 100644 --- a/docs/doc/arrayrepr.html +++ b/docs/doc/arrayrepr.html @@ -159,6 +159,7 @@ </pre> <p>This case also covers empty lists, which are shown as <code><span class='Bracket'>⟨⟩</span></code>. This includes an empty string, as the only difference between an empty string and any other empty list is its fill element and array displays don't depend on the fill.</p> <h2 id="list-literals">List literals</h2> +<p><em>The tutorial section <a href="../tutorial/list.html#list-notation">here</a> also covers this topic.</em></p> <p>There are three kinds literal notation for lists: strings, list notation, and stranding. Strings indicate character lists (with space for the fill) and the other two can combine any sequence of elements.</p> <h3 id="strings">Strings</h3> <p>A <strong>string</strong> consists of a sequence of characters surrounded by double quotes <code><span class='String'>""</span></code>. The only rule for the characters inside is that any double quote must be escaped by repeating it twice; otherwise the string ends at that point.</p> diff --git a/docs/doc/context.html b/docs/doc/context.html index 8c0ea92e..b08f70a0 100644 --- a/docs/doc/context.html +++ b/docs/doc/context.html @@ -59,7 +59,7 @@ <p>The associations between spelling and syntactic role are considered part of BQN's <a href="../spec/token.html">token formation rules</a>.</p> <p>One rule for typing is also best considered to be a pre-parsing rule like the spelling system: the role of a brace construct <code><span class='Brace'>{}</span></code> with no header is determined by which special arguments it uses: it's a subject if there are none, but a <code><span class='Value'>𝕨</span></code> or <code><span class='Value'>𝕩</span></code> makes it at least a function, an <code><span class='Function'>𝔽</span></code> makes it a 1- or 2-modifier, and a <code><span class='Function'>𝔾</span></code> always makes it a 2-modifier.</p> <h2 id="bqns-grammar">BQN's grammar</h2> -<p>A formal treatment is included in <a href="../spec/grammar.html">the spec</a>. BQN's grammar—the ways syntactic roles interact—follows the original APL model (plus trains) closely, with allowances for new features like list notation. In order to keep BQN's syntax context-free, the syntactic role of any expression must be known from its contents, just like tokens.</p> +<p>A formal treatment is included in <a href="../spec/grammar.html">the spec</a>. BQN's grammar—the ways syntactic roles interact—follows the original APL model (plus trains) closely, with allowances for new features like <a href="arrayrepr.html#list-literals">list notation</a>. In order to keep BQN's syntax context-free, the syntactic role of any expression must be known from its contents, just like tokens.</p> <p>Here is a table of the APL-derived modifier and function application rules:</p> <table> <thead> diff --git a/docs/doc/control.html b/docs/doc/control.html index ad6c65f8..9dc6e2a8 100644 --- a/docs/doc/control.html +++ b/docs/doc/control.html @@ -185,7 +185,7 @@ <span class='Brace'>}</span> </pre> <p>The initialization can be a simple expression as shown; in fact it's a little silly to make initialization one of the arguments to <code><span class='Function'>For</span></code> at all.Unlike in C, it's impossible to declare a variable that's local to the whole <code><span class='Function'>For</span></code> loop but not its surroundings. Hopefully this is obvious from the structure of the code! Only curly braces can create a new scope, so to localize some variables in the <code><span class='Function'>For</span></code> loop, just surround it in an extra set of curly braces.</p> -<p>The <code><span class='Function'>While</span></code> loop alone allows syntax similar to the <code><span class='Function'>For</span></code> loop. Perform any initialization outside of the loop, and compose the post-action with the main body using the reverse composition <code><span class='Brace'>{</span><span class='Function'>𝔾</span><span class='Modifier2'>∘</span><span class='Function'>𝔽</span><span class='Brace'>}</span></code>. Because the composition binds less tightly than stranding, the bracketed list notation has to be used here.</p> +<p>The <code><span class='Function'>While</span></code> loop alone allows syntax similar to the <code><span class='Function'>For</span></code> loop. Perform any initialization outside of the loop, and compose the post-action with the main body using the reverse composition <code><span class='Brace'>{</span><span class='Function'>𝔾</span><span class='Modifier2'>∘</span><span class='Function'>𝔽</span><span class='Brace'>}</span></code>. Because the composition binds less tightly than stranding, the bracketed <a href="arrayrepr.html#brackets">list notation</a> has to be used here.</p> <pre><span class='Value'>c</span><span class='Gets'>←</span><span class='Number'>27</span> <span class='Separator'>⋄</span> <span class='Value'>n</span><span class='Gets'>←</span><span class='Number'>0</span> <span class='Function'>While</span> <span class='Bracket'>⟨</span><span class='Brace'>{</span><span class='Value'>𝕤</span><span class='Separator'>⋄</span><span class='Number'>1</span><span class='Function'><</span><span class='Value'>c</span><span class='Brace'>}</span><span class='Separator'>,</span> <span class='Brace'>{</span><span class='Value'>𝕤</span><span class='Separator'>⋄</span><span class='Value'>n</span><span class='Function'>+</span><span class='Gets'>↩</span><span class='Number'>1</span><span class='Brace'>}{</span><span class='Function'>𝔾</span><span class='Modifier2'>∘</span><span class='Function'>𝔽</span><span class='Brace'>}{</span><span class='Value'>𝕤</span> <span class='Function'>Match</span> <span class='Paren'>(</span><span class='Number'>2</span><span class='Function'>|</span><span class='Value'>c</span><span class='Paren'>)</span><span class='Ligature'>‿</span><span class='Brace'>{</span> diff --git a/docs/doc/fromDyalog.html b/docs/doc/fromDyalog.html index d213dbb5..4568fd31 100644 --- a/docs/doc/fromDyalog.html +++ b/docs/doc/fromDyalog.html @@ -108,7 +108,7 @@ </table> <p>BQN doesn't have guards: it uses modifiers or <a href="control.html">control structures</a> instead. However, BQN function and modifier blocks have headers that allow pattern matching. See the <a href="block.html">block</a> documentation.</p> <p>The assignment arrow <code><span class='Gets'>←</span></code> defines a new variable in a block, while <code><span class='Gets'>↩</span></code> modifies an existing one.</p> -<p>BQN uses the ligature character <code><span class='Ligature'>‿</span></code> for stranding, instead of plain juxtaposition. It also has a <a href="syntax.html#list-notation">list notation</a> using <code><span class='Bracket'>⟨⟩</span></code>.</p> +<p>BQN uses the ligature character <code><span class='Ligature'>‿</span></code> for stranding, instead of plain juxtaposition. It also has a <a href="arrayrepr.html#brackets">list notation</a> using <code><span class='Bracket'>⟨⟩</span></code>.</p> <h2 id="for-reading">For reading</h2> <p>Here are some closest equivalents in Dyalog APL for the BQN functions that don't use the same glyphs as APL. Correspondence can be approximate, and <code><span class='Function'>⌽</span></code> is just used as a decorator to mean "reverse some things".</p> <table> diff --git a/docs/doc/fromJ.html b/docs/doc/fromJ.html index e5407e07..3dcb7473 100644 --- a/docs/doc/fromJ.html +++ b/docs/doc/fromJ.html @@ -107,7 +107,7 @@ </tr> </tbody> </table> -<p>BQN's explicit functions and modifiers are called "blocks", and have a more sophisticated syntax than J; see <a href="block.html">the documentation</a>. BQN uses <a href="lexical.html">lexical scope</a>, and has no global variables. BQN also has a <a href="syntax.html#list-notation">list notation</a> using <code><span class='Bracket'>⟨⟩</span></code>.</p> +<p>BQN's explicit functions and modifiers are called "blocks", and have a more sophisticated syntax than J; see <a href="block.html">the documentation</a>. BQN uses <a href="lexical.html">lexical scope</a>, and has no global variables. BQN also has a <a href="arrayrepr.html#brackets">list notation</a> using <code><span class='Bracket'>⟨⟩</span></code>.</p> <h2 id="for-reading">For reading</h2> <p>J analogues of BQN primitive functions are given below. They are not always the same; usually this is because BQN has extra functionality relative to J, although in some cases it has less or different functionality.</p> <p>Functions <code><span class='Function'>+</span></code> <code><span class='Function'>-</span></code> <code><span class='Function'>|</span></code> <code><span class='Function'><</span></code> <code><span class='Function'>></span></code> are the same in both languages.</p> diff --git a/docs/doc/syntax.html b/docs/doc/syntax.html index c22de4f6..1eab4d0c 100644 --- a/docs/doc/syntax.html +++ b/docs/doc/syntax.html @@ -137,7 +137,7 @@ </pre> <p>BQN's built-in operations also have patterns to indicate the syntactic role: 1-modifiers (<code><span class='Modifier'>˜¨˘⁼⌜´`</span></code>) are all superscript characters, and 2-modifiers (<code><span class='Modifier2'>∘○⊸⟜⌾⊘◶⚇⎉⍟</span></code>) all have an unbroken circle (two functions <code><span class='Function'>⌽⍉</span></code> have broken circles with lines through them). Every other built-in constant is a function, although the special symbols <code><span class='Number'>¯</span></code>, <code><span class='Number'>∞</span></code>, and <code><span class='Number'>π</span></code> are used as part of numeric literal notation.</p> <h3 id="assignment">Assignment</h3> -<p>Another element that can be included in expressions is assignment, which is written with <code><span class='Gets'>←</span></code> to <em>define</em> (also called "declare" in many other languages) a variable and <code><span class='Gets'>↩</span></code> to <em>change</em> its definition. A variable can only be defined once within a scope, and can only be changed if it has already been defined. However, it can be shadowed, meaning that it is defined again in an inner scope even though it has a definition in an outer scope already.</p> +<p>Another element that can be included in expressions is assignment, which is written with <code><span class='Gets'>←</span></code> to <em>define</em> (also called "declare" in many other languages) a variable and <code><span class='Gets'>↩</span></code> to <em>change</em> its definition. A variable can only be defined once within a <a href="lexical.html">scope</a>, and can only be changed if it has already been defined. However, it can be shadowed, meaning that it is defined again in an inner scope even though it has a definition in an outer scope already.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=eOKGkDEg4ouEIHt44oaQMiDii4QgeOKGqTMg4ouEIHh9Cng=">↗️</a><pre> <span class='Value'>x</span><span class='Gets'>←</span><span class='Number'>1</span> <span class='Separator'>⋄</span> <span class='Brace'>{</span><span class='Value'>x</span><span class='Gets'>←</span><span class='Number'>2</span> <span class='Separator'>⋄</span> <span class='Value'>x</span><span class='Gets'>↩</span><span class='Number'>3</span> <span class='Separator'>⋄</span> <span class='Value'>x</span><span class='Brace'>}</span> 3 <span class='Value'>x</span> @@ -163,6 +163,7 @@ <h3 id="separators">Separators</h3> <p>The characters <code><span class='Separator'>⋄</span></code> and <code><span class='Separator'>,</span></code> and newline are completely interchangeable and are used to separate expressions. An expression might be an element in a list or a line in a function. Empty sections—those that consist only of whitespace—are ignored. This means that any number of separators can be used between expressions, and that leading and trailing separators are also allowed. The expressions are evaluated in text order: left to right and top to bottom.</p> <h3 id="list-notation">List notation</h3> +<p><em><a href="arrayrepr.html#list-literals">Full documentation</a></em></p> <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> <h3 id="blocks">Blocks</h3> <p><em><a href="block.html">Full documentation</a></em></p> diff --git a/docs/index.html b/docs/index.html index b22d6707..7a23a015 100644 --- a/docs/index.html +++ b/docs/index.html @@ -36,7 +36,7 @@ </ul> <p>But BQN is redesigned from the ground up, with brand new ideas to make these paradigms easier to use and less likely to fail.</p> <ul> -<li>The <a href="doc/based.html"><strong>based array model</strong></a> eliminates the surprise of floating arrays and the hassle of explicit boxes, while dedicated <a href="tutorial/list.html#list-notation"><strong>list notation</strong></a> does away with <a href="https://aplwiki.com/wiki/Strand_notation">stranding</a> gotchas.</li> +<li>The <a href="doc/based.html"><strong>based array model</strong></a> eliminates the surprise of floating arrays and the hassle of explicit boxes, while dedicated <a href="doc/arrayrepr.html#list-literals"><strong>list notation</strong></a> does away with <a href="https://aplwiki.com/wiki/Strand_notation">stranding</a> gotchas.</li> <li><a href="doc/context.html"><strong>Context-free grammar</strong></a> makes it easier for machines and humans to understand code, and naturally leads to <a href="doc/functional.html"><strong>first-class functions</strong></a>, which can even be used to <a href="doc/control.html">reinvent control structures</a>.</li> <li><a href="keymap.html"><strong>New symbols</strong></a> for built-in functionality make the syntactic role of every primitive instantly visible, and aim to be more consistent and intuitive.</li> <li>No-nonsense <a href="doc/namespace.html"><strong>namespace syntax</strong></a> encapsulates data and even allows for a little <a href="doc/oop.html">object-oriented programming</a>.</li> |
