diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-01-24 19:55:58 -0500 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-01-24 19:55:58 -0500 |
| commit | ab94ef9c46883f5c3b2a6d4561dad840f09c5caa (patch) | |
| tree | 7203fbaeb3159a19069d5ae1c53cc18dfa6ebadf | |
| parent | c6eaee8b153ac18d4faf6cf5daed8c531c5393cf (diff) | |
Add section on syntax to BQN-Dyalog dictionary
| -rw-r--r-- | doc/fromDyalog.md | 21 | ||||
| -rw-r--r-- | docs/doc/fromDyalog.html | 40 |
2 files changed, 61 insertions, 0 deletions
diff --git a/doc/fromDyalog.md b/doc/fromDyalog.md index a3c7c7a2..68973091 100644 --- a/doc/fromDyalog.md +++ b/doc/fromDyalog.md @@ -32,6 +32,27 @@ Dyalog uses value types (array, function, and so on) to determine syntax while B | Dyadic operator | 2-modifier | | Niladic function | *go away* | +## Syntax + +BQN comments are written with `#`, not `⍝`. BQN strings use double quotes `""` while single quotes `''` enclose a character. + +BQN's functions use `{}`, like Dyalog's dfns. The names for inputs and self-reference are different: + +| Dyalog | BQN | +|--------|-----| +| `⍺` | `𝕨` | +| `⍵` | `𝕩` | +| `∇` | `𝕊` | +| `⍺⍺` | `𝔽` | +| `⍵⍵` | `𝔾` | +| `∇∇` | `𝕣` | + +BQN doesn't have guards: it uses modifiers or [control structures](control.md) instead. However, BQN function and modifier blocks have headers that allow pattern matching. See the [block](block.md) documentation. + +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 `⟨⟩`. + ## For reading 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 `⌽` is just used as a decorator to mean "reverse some things". diff --git a/docs/doc/fromDyalog.html b/docs/doc/fromDyalog.html index 68e4758f..f9c7eeaa 100644 --- a/docs/doc/fromDyalog.html +++ b/docs/doc/fromDyalog.html @@ -69,6 +69,46 @@ </tr> </tbody> </table> +<h2 id="syntax">Syntax</h2> +<p>BQN comments are written with <code><span class='Comment'>#</span></code>, not <code><span class='Value'>⍝</span></code>. BQN strings use double quotes <code><span class='String'>""</span></code> while single quotes <code><span class='String'>''</span></code> enclose a character.</p> +<p>BQN's functions use <code><span class='Brace'>{}</span></code>, like Dyalog's dfns. The names for inputs and self-reference are different:</p> +<table> +<thead> +<tr> +<th>Dyalog</th> +<th>BQN</th> +</tr> +</thead> +<tbody> +<tr> +<td><code><span class='Value'>⍺</span></code></td> +<td><code><span class='Value'>𝕨</span></code></td> +</tr> +<tr> +<td><code><span class='Value'>⍵</span></code></td> +<td><code><span class='Value'>𝕩</span></code></td> +</tr> +<tr> +<td><code><span class='Value'>∇</span></code></td> +<td><code><span class='Function'>𝕊</span></code></td> +</tr> +<tr> +<td><code><span class='Value'>⍺⍺</span></code></td> +<td><code><span class='Function'>𝔽</span></code></td> +</tr> +<tr> +<td><code><span class='Value'>⍵⍵</span></code></td> +<td><code><span class='Function'>𝔾</span></code></td> +</tr> +<tr> +<td><code><span class='Value'>∇∇</span></code></td> +<td><code><span class='Value'>𝕣</span></code></td> +</tr> +</tbody> +</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> <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> |
