aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-07-21 19:48:24 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-07-21 19:48:24 -0400
commit93f75e97685520cdad3afab0134e2f65e5e211e2 (patch)
tree790c97ead26f8417b199922136f69397c703ddad /doc
parentb3ecbb5695a5a0a0637c924da0022abca940ffee (diff)
Add Insert (˝) 1-modifier
Diffstat (limited to 'doc')
-rw-r--r--doc/context.md2
-rw-r--r--doc/fromDyalog.md8
-rw-r--r--doc/group.md6
-rw-r--r--doc/transpose.md2
-rw-r--r--doc/windows.md4
5 files changed, 11 insertions, 11 deletions
diff --git a/doc/context.md b/doc/context.md
index fe800cfa..bf2183bb 100644
--- a/doc/context.md
+++ b/doc/context.md
@@ -38,7 +38,7 @@ BQN's expression grammar is a simplified version of the typical APL, removing so
| 1-modifier | Monadic operator | Adverb
| 2-modifier | Dyadic operator | Conjunction
-Unlike variables, BQN primitives have only one spelling, and a fixed role (but their values can be used in a different role by storing them in variables). Superscript glyphs `` ˜¨˘⁼⌜´` `` are used for 1-modifiers, and glyphs `∘○⊸⟜⌾⊘◶⚇⎉⍟` with an unbroken circle are 2-modifiers. Other primitives are functions. String and numeric literals are subjects.
+Unlike variables, BQN primitives have only one spelling, and a fixed role (but their values can be used in a different role by storing them in variables). Superscript glyphs `` ˜¨˘⁼⌜´˝` `` are used for 1-modifiers, and glyphs `∘○⊸⟜⌾⊘◶⚇⎉⍟` with an unbroken circle are 2-modifiers. Other primitives are functions. String and numeric literals are subjects.
BQN's variables use another system, where the spelling indicates how the variable's value is used. A variable spelled with a lowercase first letter, like `var`, is a subject. Spelled with an uppercase first letter, like `Var`, it is a function. Underscores are placed where operands apply to indicate a 1-modifier `_var` or 2-modifier `_var_`. Other than the first letter or underscore, variables are case-insensitive.
diff --git a/doc/fromDyalog.md b/doc/fromDyalog.md
index 3eaf752d..2f4e5aae 100644
--- a/doc/fromDyalog.md
+++ b/doc/fromDyalog.md
@@ -20,7 +20,7 @@ Here are some closest equivalents in Dyalog APL for the BQN functions that don't
Modifiers are a little harder. Many have equivalents in some cases, but Dyalog sometimes chooses different functionality based on whether the operand is an array. In BQN an array is always treated as a constant function.
-| BQN | `¨` | `⌜` | `´` | `⎉` | `⍟` | `˜` | `∘` | `○` | `⟜` |
+| BQN | `¨` | `⌜` | `˝` | `⎉` | `⍟` | `˜` | `∘` | `○` | `⟜` |
|--------|-----|------|-----|-----|-----|-----|-----|-----|-----|
| Dyalog | `¨` | `∘.` | `⌿` | `⍤` | `⍣` | `⍨` | `⍤` | `⍥` | `∘` |
@@ -62,19 +62,19 @@ The tables below give approximate implementations of Dyalog primitives for the o
<tr><td> <code>⍕</code> </td> </tr>
<tr><td> <code>⊥</code> </td><td> </td><td> <code>{+⟜(𝕨⊸×)´⌽𝕩}</code> </td> </tr>
<tr><td> <code>⊤</code> </td><td> </td><td> <code>{𝕨|1↓⌊∘÷`⌾⌽𝕨∾<𝕩}</code></td> </tr>
-<tr><td> <code>⌹</code> </td><td colspan=2><code>+´∘×⎉1‿∞⁼</code> I guess</td> </tr>
+<tr><td> <code>⌹</code> </td><td colspan=2><code>+˝∘×⎉1‿∞⁼</code> I guess</td> </tr>
<tr><td> <code>⌷</code> </td><td> N/A </td><td> <code>⊏</code></td> </tr>
</table>
<table>
<tr><th colspan=3>Operators</th></tr>
<tr><th> Syntax </th><th> Monadic </th><th> Dyadic </th></tr>
-<tr><td> <code>⌿</code> </td><td> <code>´</code> </td><td> <code>↕</code> </td></tr>
+<tr><td> <code>⌿</code> </td><td> <code>¨˝</code> </td><td> <code>↕</code> </td></tr>
<tr><td> <code>⍀</code> </td><td colspan=2> <code>↑</code> or <code>`</code> </td></tr>
<tr><td> <code>¨</code> </td><td colspan=2> <code>¨</code> </td></tr>
<tr><td> <code>⍨</code> </td><td colspan=2> <code>˜</code> </td></tr>
<tr><td> <code>⍣</code> </td><td colspan=2> <code>⍟</code> </td></tr>
-<tr><td> <code>f.g</code> </td><td> </td><td> <code>(f´<˘)∘g⎉1‿∞</code></td></tr>
+<tr><td> <code>f.g</code> </td><td> </td><td> <code>f˝∘g⎉1‿∞</code> </td></tr>
<tr><td> <code>∘.f</code> </td><td> </td><td> <code>f⌜</code> </td></tr>
<tr><td> <code>A∘g</code> </td><td> <code>A⊸g</code> </td><td> </td></tr>
<tr><td> <code>f∘B</code> </td><td> <code>f⟜B</code> </td><td> </td></tr>
diff --git a/doc/group.md b/doc/group.md
index dcf13220..e043e5ca 100644
--- a/doc/group.md
+++ b/doc/group.md
@@ -103,6 +103,6 @@ In other cases, we might want to split on spaces, so that words are separated by
However, trailing spaces are ignored because Group never produces trailing empty groups (to get them back we would use a dummy final character in the string). To avoid empty words, we should increase the word index only once per group of spaces. We can do this by taking the prefix sum of a list that is 1 only for a space with no space before it. To make such a list, we can use the [Windows](windows.md) function. We will extend our list with an initial 1 so that leading spaces will be ignored. Then we take windows of the same length as the original list: the first includes the dummy argument followed by a shifted copy of the list, and the second is the original list. These represent whether the previous and current characters are spaces; we want positions where the previous wasn't a space and the current is.
- ≍⟜((<´<˘)≠↕1∾⊢) ' '=" string with spaces " # All, then filtered, spaces
- ≍⟜(⊢-˜¬×+`∘((<´<˘)≠↕1∾⊢))' '=" string with spaces " # More processing
- ' '((⊢-˜¬×+`∘((<´<˘)≠↕1∾⊢))∘=⊔⊢)" string with spaces " # Final result
+ ≍⟜(<˝≠↕1∾⊢) ' '=" string with spaces " # All, then filtered, spaces
+ ≍⟜(⊢-˜¬×+`∘(<˝≠↕1∾⊢))' '=" string with spaces " # More processing
+ ' '((⊢-˜¬×+`∘(<˝≠↕1∾⊢))∘=⊔⊢)" string with spaces " # Final result
diff --git a/doc/transpose.md b/doc/transpose.md
index 3e7bf5c3..21628dcd 100644
--- a/doc/transpose.md
+++ b/doc/transpose.md
@@ -6,7 +6,7 @@ As in APL, Transpose (`⍉`) is a tool for rearranging the axes of an array. BQN
## Monadic Transpose
-Transposing a matrix exchanges its axes, mirroring it across the diagonal. APL extends the function to any rank by reversing all axes, but this generalization isn't very natural and is almost never used. The main reason for it is to maintain the equivalence `a MP b ←→ a MP⌾⍉ b`, where `MP ← (+´<˘)∘×⎉1‿∞` is the generalized matrix product. But even here APL's Transpose is suspect. It does much more work than it needs to, as we'll see.
+Transposing a matrix exchanges its axes, mirroring it across the diagonal. APL extends the function to any rank by reversing all axes, but this generalization isn't very natural and is almost never used. The main reason for it is to maintain the equivalence `a MP b ←→ a MP⌾⍉ b`, where `MP ← +˝∘×⎉1‿∞` is the generalized matrix product. But even here APL's Transpose is suspect. It does much more work than it needs to, as we'll see.
BQN's transpose takes the first axis of its argument and moves it to the end.
diff --git a/doc/windows.md b/doc/windows.md
index a60e1ae0..2f1eda55 100644
--- a/doc/windows.md
+++ b/doc/windows.md
@@ -68,8 +68,8 @@ Windows can be followed up with a reduction on each slice to give a windowed red
A common task is to pair elements, with an initial or final element so the total length stays the same. This can also be done with a pairwise reduction, but another good way (and more performant without special support in the interpreter) is to add the element and then use windows matching the original length. Here both methods are used to invert `` +` ``, which requires we take pairwise differences starting at initial value 0.
-˜´˘2↕0∾ +` 3‿2‿1‿1
- ((-˜´<˘)≠↕0∾⊢) +` 3‿2‿1‿1
+ (-˜˝≠↕0∾⊢) +` 3‿2‿1‿1
This method extends to any number of initial elements. We can modify the running sum above to keep the length constant by starting with two zeros.
- ((+´<˘)≠↕(2⥊0)⊸∾) ⟨2,6,0,1,4,3⟩
+ (+˝≠↕(2⥊0)⊸∾) ⟨2,6,0,1,4,3⟩