aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2022-01-08 16:14:51 -0500
committerMarshall Lochbaum <mwlochbaum@gmail.com>2022-01-08 16:18:16 -0500
commitc5eef0418df2ae6a97c54839fa010ff60d96f78b (patch)
tree7ad892f4d416cfcf380e3a26164df4d240a82037 /docs
parentded5581732544165dbb14fb2481ab3855104c638 (diff)
Add error messages to generated markdown docs with •CurrentError (fixes #22)
Diffstat (limited to 'docs')
-rw-r--r--docs/doc/arrayrepr.html2
-rw-r--r--docs/doc/assert.html8
-rw-r--r--docs/doc/block.html4
-rw-r--r--docs/doc/enclose.html2
-rw-r--r--docs/doc/find.html2
-rw-r--r--docs/doc/join.html4
-rw-r--r--docs/doc/lexical.html6
-rw-r--r--docs/doc/map.html6
-rw-r--r--docs/doc/match.html2
-rw-r--r--docs/doc/order.html4
-rw-r--r--docs/doc/pair.html2
-rw-r--r--docs/doc/pick.html8
-rw-r--r--docs/doc/rebqn.html2
-rw-r--r--docs/doc/reshape.html4
-rw-r--r--docs/doc/reverse.html6
-rw-r--r--docs/doc/select.html6
-rw-r--r--docs/doc/undo.html2
-rw-r--r--docs/style.css2
-rw-r--r--docs/tutorial/list.html2
-rw-r--r--docs/tutorial/variable.html8
20 files changed, 42 insertions, 40 deletions
diff --git a/docs/doc/arrayrepr.html b/docs/doc/arrayrepr.html
index a6da93aa..43c0ad51 100644
--- a/docs/doc/arrayrepr.html
+++ b/docs/doc/arrayrepr.html
@@ -167,7 +167,7 @@
"-'×%""*"
<span class='String'>&quot;-'×%&quot;</span><span class='Value'>*</span><span class='String'>&quot;</span> <span class='Comment'># Escaping failure
-</span>ERROR
+</span><span class='Error'>Error: Unclosed quote</span>
</pre>
<p>Even special characters like a newline can appear in a string literal, so that string literals are automatically multi-line.</p>
<h3 id="brackets"><a class="header" href="#brackets">Brackets</a></h3>
diff --git a/docs/doc/assert.html b/docs/doc/assert.html
index 2e112283..1d56a9ed 100644
--- a/docs/doc/assert.html
+++ b/docs/doc/assert.html
@@ -9,19 +9,19 @@
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=ISAyPTIgICMgUGFzc2VkCiEgMj0zICAjIEZhaWxlZA==">↗️</a><pre> <span class='Function'>!</span> <span class='Number'>2</span><span class='Function'>=</span><span class='Number'>2</span> <span class='Comment'># Passed
</span>1
<span class='Function'>!</span> <span class='Number'>2</span><span class='Function'>=</span><span class='Number'>3</span> <span class='Comment'># Failed
-</span>ERROR
+</span><span class='Error'>Error: Assertion error</span>
</pre>
<p>To pass, the right argument must be exactly the number <code><span class='Number'>1</span></code>; any other value causes an error. For example, an array of <code><span class='Number'>1</span></code>s still causes an error; use <code><span class='Function'>∧</span><span class='Modifier'>´</span><span class='Function'>⥊</span></code> to convert a boolean array to a single boolean that indicates whether all of its values are true.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=ISAo4oinPeKIqOKMvsKsKeKMnMucIOKGlTIKISDiiKfCtOKliiAo4oinPeKIqOKMvsKsKeKMnMucIOKGlTI=">↗️</a><pre> <span class='Function'>!</span> <span class='Paren'>(</span><span class='Function'>∧=∨</span><span class='Modifier2'>⌾</span><span class='Function'>¬</span><span class='Paren'>)</span><span class='Modifier'>⌜˜</span> <span class='Function'>↕</span><span class='Number'>2</span>
-ERROR
+<span class='Error'>Error: 2‿2⥊1‿1‿1‿1</span>
<span class='Function'>!</span> <span class='Function'>∧</span><span class='Modifier'>´</span><span class='Function'>⥊</span> <span class='Paren'>(</span><span class='Function'>∧=∨</span><span class='Modifier2'>⌾</span><span class='Function'>¬</span><span class='Paren'>)</span><span class='Modifier'>⌜˜</span> <span class='Function'>↕</span><span class='Number'>2</span>
1
</pre>
<p>Assert can take a left argument, which gives a message to be associated with the error. It's typical to use a string for the left argument in order to display it to the programmer, but the left argument can be any value.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Ik1lc3NhZ2UiICEgMArin6jiiJgsImFiYyIsy5zin6kgISAnMCcgICMgT2theSB0aGlzIGlzIG5vdCBhIHZlcnkgaGVscGZ1bCBwcmludG91dA==">↗️</a><pre> <span class='String'>&quot;Message&quot;</span> <span class='Function'>!</span> <span class='Number'>0</span>
-ERROR
+<span class='Error'>Error: Message</span>
<span class='Bracket'>⟨</span><span class='Modifier2'>∘</span><span class='Separator'>,</span><span class='String'>&quot;abc&quot;</span><span class='Separator'>,</span><span class='Modifier'>˜</span><span class='Bracket'>⟩</span> <span class='Function'>!</span> <span class='String'>'0'</span> <span class='Comment'># Okay this is not a very helpful printout
-</span>ERROR
+</span><span class='Error'>Error: ⟨∘,"abc",˜⟩</span>
</pre>
<h3 id="computing-the-error-message-on-demand"><a class="header" href="#computing-the-error-message-on-demand">Computing the error message on demand</a></h3>
<p>Because the left argument to a function is always computed before the function is called, Assert <a href="../commentary/problems.html#assert-has-no-way-to-compute-the-error-message">doesn't let you</a> compute the error message only if there's an error. This might be a problem if the error message computation is slow or has side effects. There are a few ways to work around the issue:</p>
diff --git a/docs/doc/block.html b/docs/doc/block.html
index 5e957e1e..64643e7d 100644
--- a/docs/doc/block.html
+++ b/docs/doc/block.html
@@ -201,7 +201,7 @@
</pre>
<p>If no header is compatible, the call results in an error.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MyBDYXNlQWRkIDM=">↗️</a><pre> <span class='Number'>3</span> <span class='Function'>CaseAdd</span> <span class='Number'>3</span>
-ERROR
+<span class='Error'>Error: No header matched arguments</span>
</pre>
<h3 id="case-headers"><a class="header" href="#case-headers">Case headers</a></h3>
<p>A special rule allows for convenient case-matching syntax for one-argument functions. In any function header with one argument, the function name can be omitted as long as the argument is <em>not</em> a plain identifier—it must be <code><span class='Value'>𝕩</span></code> or a compound value like a list to distinguish it from an immediate block label.</p>
@@ -239,6 +239,6 @@ ERROR
</pre>
<p>This structure is still constrained by the rules of block bodies: each instance of <code><span class='Value'>;</span></code> is a separate scope, so that variables defined before a <code><span class='Value'>?</span></code> don't survive past the <code><span class='Value'>;</span></code>.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=eyAwPW7ihpDiiaDwnZWpID8g4oieIDsgbiB9ICJhYmMi">↗️</a><pre> <span class='Brace'>{</span> <span class='Number'>0</span><span class='Function'>=</span><span class='Value'>n</span><span class='Gets'>←</span><span class='Function'>≠</span><span class='Value'>𝕩</span> <span class='Value'>?</span> <span class='Number'>∞</span> <span class='Value'>;</span> <span class='Value'>n</span> <span class='Brace'>}</span> <span class='String'>&quot;abc&quot;</span>
-ERROR
+<span class='Error'>Error: Undefined identifier</span>
</pre>
<p>This is the main drawback of predicates relative to guards in APL dfns (also written with <code><span class='Value'>?</span></code>), while the advantage is that it allows multiple expressions, or extra conditions, after a <code><span class='Value'>?</span></code>. It's not how I would have designed it if I just wanted to make a syntax for if statements, but it's a natural fit for the header system.</p>
diff --git a/docs/doc/enclose.html b/docs/doc/enclose.html
index aac48d68..2a401603 100644
--- a/docs/doc/enclose.html
+++ b/docs/doc/enclose.html
@@ -39,7 +39,7 @@
</pre>
<p>In this case each call to <code><span class='Function'>+</span><span class='Modifier'>˝</span></code> returns a cell of the result. The result is a list, so its cells are units! Here, Cells (<code><span class='Modifier'>˘</span></code>) &quot;hides&quot; one axis from its operand, and the operand <code><span class='Function'>+</span><span class='Modifier'>˝</span></code> reduces out an axis, leaving zero axes—until Cells assembles the results, putting its axis back. In this case, <code><span class='Function'>+</span><span class='Modifier'>´</span></code> would also be tolerated. But it's wrong, because each result really should be a zero-axis array. We can reveal this by making an array whose elements aren't atoms.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=K8K0y5gg4p+o4oaVMiwiYWIi4p+p4omN4p+o4oaVMywiQUJDIuKfqQory53LmCDin6jihpUyLCJhYiLin6niiY3in6jihpUzLCJBQkMi4p+p">↗️</a><pre> <span class='Function'>+</span><span class='Modifier'>´˘</span> <span class='Bracket'>⟨</span><span class='Function'>↕</span><span class='Number'>2</span><span class='Separator'>,</span><span class='String'>&quot;ab&quot;</span><span class='Bracket'>⟩</span><span class='Function'>≍</span><span class='Bracket'>⟨</span><span class='Function'>↕</span><span class='Number'>3</span><span class='Separator'>,</span><span class='String'>&quot;ABC&quot;</span><span class='Bracket'>⟩</span>
-ERROR
+<span class='Error'>Error: >: Elements didn't have equal shapes (contained ⟨2⟩ and ⟨3⟩)</span>
<span class='Function'>+</span><span class='Modifier'>˝˘</span> <span class='Bracket'>⟨</span><span class='Function'>↕</span><span class='Number'>2</span><span class='Separator'>,</span><span class='String'>&quot;ab&quot;</span><span class='Bracket'>⟩</span><span class='Function'>≍</span><span class='Bracket'>⟨</span><span class='Function'>↕</span><span class='Number'>3</span><span class='Separator'>,</span><span class='String'>&quot;ABC&quot;</span><span class='Bracket'>⟩</span>
⟨ "ac" "ACE" ⟩
</pre>
diff --git a/docs/doc/find.html b/docs/doc/find.html
index 85f26297..09632469 100644
--- a/docs/doc/find.html
+++ b/docs/doc/find.html
@@ -37,7 +37,7 @@
⟨⟩
<span class='Number'>9</span> <span class='Function'>↕</span> <span class='String'>&quot;short&quot;</span>
-ERROR
+<span class='Error'>Error: 𝕨↕𝕩: Window length 𝕨 must be at most axis length plus one</span>
<span class='Number'>0</span> <span class='Function'>⊣</span><span class='Modifier'>´</span> <span class='String'>&quot;loooooong&quot;</span> <span class='Function'>⍷</span> <span class='String'>&quot;short&quot;</span>
0
diff --git a/docs/doc/join.html b/docs/doc/join.html
index 56975907..9f93eae4 100644
--- a/docs/doc/join.html
+++ b/docs/doc/join.html
@@ -34,7 +34,7 @@
</pre>
<p>For this definition to work, major cells of <code><span class='Value'>𝕨</span></code> and <code><span class='Value'>𝕩</span></code> have to have the same shape. That means that <code><span class='Value'>𝕨</span><span class='Function'>≡</span><span class='Modifier2'>○</span><span class='Paren'>(</span><span class='Number'>1</span><span class='Function'>↓≢</span><span class='Paren'>)</span><span class='Value'>𝕩</span></code>, and the shape of the result is the sum of the lengths of <code><span class='Value'>𝕨</span></code> and <code><span class='Value'>𝕩</span></code> followed by their shared major cell shape: to use a self-referential definition, the final shape is given by <code><span class='Function'>+</span><span class='Modifier2'>○</span><span class='Function'>≠</span> <span class='Function'>∾</span> <span class='Function'>⊣</span><span class='Modifier'>⁼</span><span class='Modifier2'>○</span><span class='Paren'>(</span><span class='Number'>1</span><span class='Function'>↓≢</span><span class='Paren'>)</span></code> for arguments of equal rank.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=YSDiiL4gMuKAvzXipYpiICAjIFNoYXBlcyBkb24ndCBmaXQ=">↗️</a><pre> <span class='Value'>a</span> <span class='Function'>∾</span> <span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>5</span><span class='Function'>⥊</span><span class='Value'>b</span> <span class='Comment'># Shapes don't fit
-</span>ERROR
+</span><span class='Error'>Error: ∾: Lengths not matchable (3‿4 ≡ ≢𝕨, 2‿5 ≡ ≢𝕩)</span>
</pre>
<p>Join To will also allow arguments with ranks that are one apart. In this case, the smaller-rank argument is treated as a major cell in its entirety. If for example <code><span class='Value'>𝕨</span><span class='Function'>&lt;</span><span class='Modifier2'>○</span><span class='Function'>=</span><span class='Value'>𝕩</span></code>, then we must have <code><span class='Paren'>(</span><span class='Function'>≢</span><span class='Value'>𝕨</span><span class='Paren'>)</span><span class='Function'>≡</span><span class='Number'>1</span><span class='Function'>↓≢</span><span class='Value'>𝕩</span></code>, and the result shape is <code><span class='Number'>1</span><span class='Modifier2'>⊸</span><span class='Function'>+</span><span class='Modifier2'>⌾</span><span class='Function'>⊑≢</span><span class='Value'>𝕩</span></code>.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=NOKAvzLigL8z4oC/MCDiiL4gYQ==">↗️</a><pre> <span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>0</span> <span class='Function'>∾</span> <span class='Value'>a</span>
@@ -65,7 +65,7 @@
"abcdefg"
<span class='Function'>∾</span><span class='String'>&quot;abcd&quot;</span> <span class='Comment'># Result has to be rank 0, impossible
-</span>ERROR
+</span><span class='Error'>Error: ∾𝕩: 𝕩 must have an element with rank at least =𝕩</span>
</pre>
<p>However, Join has higher-dimensional uses as well. Given a rank-<code><span class='Value'>m</span></code> array of rank-<code><span class='Value'>n</span></code> arrays (requiring <code><span class='Value'>m</span><span class='Function'>≤</span><span class='Value'>n</span></code>), it will merge arrays along their first <code><span class='Value'>m</span></code> axes. For example, if the argument is a matrix of matrices representing a <a href="https://en.wikipedia.org/wiki/Block_matrix">block matrix</a>, Join will give the corresponding unblocked matrix as its result.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIG0g4oaQICgz4oC/MeKJjeKMnDTigL8y4oC/NSkg4qWKwqggMuKAvzPipYrihpU2CuKIviBtICAjIEpvaW4gYWxsIHRoYXQgdG9nZXRoZXI=">↗️</a><pre> <span class='Function'>⊢</span> <span class='Value'>m</span> <span class='Gets'>←</span> <span class='Paren'>(</span><span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Function'>≍</span><span class='Modifier'>⌜</span><span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>5</span><span class='Paren'>)</span> <span class='Function'>⥊</span><span class='Modifier'>¨</span> <span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>3</span><span class='Function'>⥊↕</span><span class='Number'>6</span>
diff --git a/docs/doc/lexical.html b/docs/doc/lexical.html
index ec3f6567..dcc5fef0 100644
--- a/docs/doc/lexical.html
+++ b/docs/doc/lexical.html
@@ -62,7 +62,7 @@
</pre>
<p>Each scope can only define a given name once. Trying to shadow a name that's in the current scope and not a higher one gives an error at compilation.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=eyBpbmPihpAzIOKLhCBpbmPihpA0IH0=">↗️</a><pre> <span class='Brace'>{</span> <span class='Value'>inc</span><span class='Gets'>←</span><span class='Number'>3</span> <span class='Separator'>⋄</span> <span class='Value'>inc</span><span class='Gets'>←</span><span class='Number'>4</span> <span class='Brace'>}</span>
-ERROR
+<span class='Error'>Error: Redefinition</span>
</pre>
<p>Let's go all in on shadowing and make a modifier that creates its own copies of <code><span class='Value'>counter</span></code> and <code><span class='Value'>inc</span></code>, returning a custom version of the <code><span class='Function'>Count</span></code> function above.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=X21ha2VDb3VudCDihpAgeyBjb3VudGVy4oC/aW5j4oaQ8J2VlyDii4QgeyBjb3VudGVyICvihqkg8J2VqSDDlyBpbmMgfSB9CgpDM183IOKGkCAz4oC/NyBfbWFrZUNvdW50ICAjIFN0YXJ0IGF0IDM7IGluYyBieSA3CgpDM183IDAKQzNfNyAxCkNvdW50IDAgICMgT2xkIGNvdW50ZXIgc3RheXMgdGhlIHNhbWU=">↗️</a><pre> <span class='Modifier'>_makeCount</span> <span class='Gets'>←</span> <span class='Brace'>{</span> <span class='Value'>counter</span><span class='Ligature'>‿</span><span class='Value'>inc</span><span class='Gets'>←</span><span class='Value'>𝕗</span> <span class='Separator'>⋄</span> <span class='Brace'>{</span> <span class='Value'>counter</span> <span class='Function'>+</span><span class='Gets'>↩</span> <span class='Value'>𝕩</span> <span class='Function'>×</span> <span class='Value'>inc</span> <span class='Brace'>}</span> <span class='Brace'>}</span>
@@ -85,7 +85,7 @@ ERROR
</pre>
<p>But you'll still get an error if the variable is used before its definition is run. Unlike the single-level case, this is a runtime error and only appears when the variable is actually accessed.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=eyAyK2QgfSDii4QgZOKGkMKvMg==">↗️</a><pre> <span class='Brace'>{</span> <span class='Number'>2</span><span class='Function'>+</span><span class='Value'>d</span> <span class='Brace'>}</span> <span class='Separator'>⋄</span> <span class='Value'>d</span><span class='Gets'>←</span><span class='Number'>¯2</span>
-ERROR
+<span class='Error'>Error: Reading variable before its defined</span>
</pre>
<p>Why define things this way? It's easier to see if you imagine the variable used is also a function. It's normal for a function to call other functions defined at the top level, of course. And it would be pretty unpleasant for BQN to enforce a specific ordering for them. It would also make recursive functions impossible except by using <code><span class='Function'>𝕊</span></code>, and mutually recursive ones completely impossible. A simple rule that makes all these things just work smoothly seems much better than any alternative.</p>
<h2 id="closures"><a class="header" href="#closures">Closures</a></h2>
@@ -140,6 +140,6 @@ ERROR
</pre>
<p>Only code with access to a variable can modify it! This means that if none of the code in a variable's scope modifies it, then the variable is a constant in each environment that contains it (not necessarily across environments). That is, constant once it's defined: it's still possible to get an error if the variable is accessed before being defined.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=eyB7IGEgfSDii4QgYeKGkDQgfQ==">↗️</a><pre> <span class='Brace'>{</span> <span class='Brace'>{</span> <span class='Value'>a</span> <span class='Brace'>}</span> <span class='Separator'>⋄</span> <span class='Value'>a</span><span class='Gets'>←</span><span class='Number'>4</span> <span class='Brace'>}</span>
-ERROR
+<span class='Error'>Error: Reading variable before its defined</span>
</pre>
<p>With lexical scoping, variable mutation automatically leads to mutable data. This is because a function or modifier that depends on the variable value changes its behavior when the variable changes. For further discussion see the documentation on <a href="oop.html#mutability">mutable objects</a>.</p>
diff --git a/docs/doc/map.html b/docs/doc/map.html
index b7c4afe5..f84421cf 100644
--- a/docs/doc/map.html
+++ b/docs/doc/map.html
@@ -219,7 +219,7 @@
</pre>
<p>If the argument lengths don't match then Each gives an error. This contrasts with zip in many languages, which drops elements from the longer argument (this is natural for linked lists). This flexibility is rarely wanted in BQN, and having an error right away saves debugging time.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=IkFCQyIg4omNwqggIjAxMjM0Ig==">↗️</a><pre> <span class='String'>&quot;ABC&quot;</span> <span class='Function'>≍</span><span class='Modifier'>¨</span> <span class='String'>&quot;01234&quot;</span>
-ERROR
+<span class='Error'>Error: Mapping: Expected equal shape prefix (⟨3⟩ ≡ ≢𝕨, ⟨5⟩ ≡ ≢𝕩)</span>
</pre>
<p>Arguments can have any shape as long as the axis lengths match up. As with Table, the result elements don't depend on these shapes but the result shape does.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=KD7in6gyMOKAvzMw4oC/MTAsNTDigL80MOKAvzYw4p+pKSAr4p+c4oaVwqggMuKAvzHigL8w4omNM+KAvzLigL8x">↗️</a><pre> <span class='Paren'>(</span><span class='Function'>&gt;</span><span class='Bracket'>⟨</span><span class='Number'>20</span><span class='Ligature'>‿</span><span class='Number'>30</span><span class='Ligature'>‿</span><span class='Number'>10</span><span class='Separator'>,</span><span class='Number'>50</span><span class='Ligature'>‿</span><span class='Number'>40</span><span class='Ligature'>‿</span><span class='Number'>60</span><span class='Bracket'>⟩</span><span class='Paren'>)</span> <span class='Function'>+</span><span class='Modifier2'>⟜</span><span class='Function'>↕</span><span class='Modifier'>¨</span> <span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>0</span><span class='Function'>≍</span><span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>1</span>
@@ -230,10 +230,10 @@ ERROR
</pre>
<p>But arguments don't have to have exactly the same shape: just the same length along corresponding axes. These axes are matched up according to the <a href="leading.html">leading axis convention</a>, so that one argument's shape has to be a prefix of the other's. With equal ranks, the shapes do have to match as we've seen above.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4omiICgw4oC/MuKAvzbipYpAKSDiiY3CqCAw4oC/MeKlijAgICMgVG9vIHNtYWxsCuKJoiAoMOKAvzLigL824qWKQCkg4omNwqggMOKAvzLipYowICAjIEp1c3QgcmlnaHQK4omiICgw4oC/MuKAvzbipYpAKSDiiY3CqCAw4oC/M+KlijAgICMgVG9vIGxhcmdl">↗️</a><pre> <span class='Function'>≢</span> <span class='Paren'>(</span><span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>6</span><span class='Function'>⥊</span><span class='String'>@</span><span class='Paren'>)</span> <span class='Function'>≍</span><span class='Modifier'>¨</span> <span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Function'>⥊</span><span class='Number'>0</span> <span class='Comment'># Too small
-</span>ERROR
+</span><span class='Error'>Error: Mapping: Expected equal shape prefix (0‿2‿6 ≡ ≢𝕨, 0‿1 ≡ ≢𝕩)</span>
<span class='Function'>≢</span> <span class='Paren'>(</span><span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>6</span><span class='Function'>⥊</span><span class='String'>@</span><span class='Paren'>)</span> <span class='Function'>≍</span><span class='Modifier'>¨</span> <span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Function'>⥊</span><span class='Number'>0</span> <span class='Comment'># Just right
</span>⟨ 0 2 6 ⟩
<span class='Function'>≢</span> <span class='Paren'>(</span><span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>6</span><span class='Function'>⥊</span><span class='String'>@</span><span class='Paren'>)</span> <span class='Function'>≍</span><span class='Modifier'>¨</span> <span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>3</span><span class='Function'>⥊</span><span class='Number'>0</span> <span class='Comment'># Too large
-</span>ERROR
+</span><span class='Error'>Error: Mapping: Expected equal shape prefix (0‿2‿6 ≡ ≢𝕨, 0‿3 ≡ ≢𝕩)</span>
</pre>
<p>Leading axis agreement is described further <a href="leading.html#leading-axis-agreement">here</a>.</p>
diff --git a/docs/doc/match.html b/docs/doc/match.html
index 1e752f6f..95336280 100644
--- a/docs/doc/match.html
+++ b/docs/doc/match.html
@@ -18,7 +18,7 @@
0
<span class='String'>&quot;abc&quot;</span> <span class='Function'>=</span> <span class='String'>&quot;ab&quot;</span> <span class='Comment'># Mismatched shapes
-</span>ERROR
+</span><span class='Error'>Error: =: Expected equal shape prefix (⟨3⟩ ≡ ≢𝕨, ⟨2⟩ ≡ ≢𝕩)</span>
<span class='String'>&quot;abc&quot;</span> <span class='Function'>≡</span> <span class='String'>&quot;ab&quot;</span>
0
</pre>
diff --git a/docs/doc/order.html b/docs/doc/order.html
index bd13f64a..1916167d 100644
--- a/docs/doc/order.html
+++ b/docs/doc/order.html
@@ -88,9 +88,9 @@
<p>The two Bins functions are written with the same symbols <code><span class='Function'>⍋</span></code> and <code><span class='Function'>⍒</span></code> as Grade, but take two arguments instead of one. More complicated? A little, but once you understand Bins you'll find that it's a basic concept that shows up in the real world all the time.</p>
<p>Bins behaves like a <a href="search.html">search function</a> with respect to rank: it looks up cells from <code><span class='Value'>𝕩</span></code> relative to major cells of <code><span class='Value'>𝕨</span></code>. However, there's an extra requirement: the left argument to Bins is already sorted according to whichever ordering is used. If it isn't, you'll get an error.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=NeKAvzbigL8y4oC/NOKAvzEg4o2LIDMKMOKAvzPigL804oC/N+KAvzkg4o2SIDM=">↗️</a><pre> <span class='Number'>5</span><span class='Ligature'>‿</span><span class='Number'>6</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>1</span> <span class='Function'>⍋</span> <span class='Number'>3</span>
-ERROR
+<span class='Error'>Error: ⍋: 𝕨 must be sorted</span>
<span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>7</span><span class='Ligature'>‿</span><span class='Number'>9</span> <span class='Function'>⍒</span> <span class='Number'>3</span>
-ERROR
+<span class='Error'>Error: ⍒: 𝕨 must be sorted in descending order</span>
</pre>
<p>Given this, the simplest definition of <code><span class='Value'>𝕨</span><span class='Function'>⍋</span><span class='Value'>𝕩</span></code> (or <code><span class='Value'>𝕨</span><span class='Function'>⍒</span><span class='Value'>𝕩</span></code>) is that for each cell in <code><span class='Value'>𝕩</span></code> of rank <code><span class='Paren'>(</span><span class='Function'>=</span><span class='Value'>𝕨</span><span class='Paren'>)</span><span class='Function'>-</span><span class='Number'>1</span></code>, it counts the number of major cells from <code><span class='Value'>𝕨</span></code> that come earlier in the ordering, or match that cell.</p>
<p>Why would that be useful? How about an example. A pinball machine has some high scores on it. You play, and your rank is the number of scores higher than yours (in this case, if you tie someone's score, you won't unseat them).</p>
diff --git a/docs/doc/pair.html b/docs/doc/pair.html
index 46f4c82d..a4bf9b75 100644
--- a/docs/doc/pair.html
+++ b/docs/doc/pair.html
@@ -51,7 +51,7 @@
</pre>
<p>And the arguments to Couple must have the same shape, while Enlist takes any two arguments.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=ImFiYyIg4omNICJkZWZnIgoKImFiYyIg4ouIICJkZWZnIg==">↗️</a><pre> <span class='String'>&quot;abc&quot;</span> <span class='Function'>≍</span> <span class='String'>&quot;defg&quot;</span>
-ERROR
+<span class='Error'>Error: ≍: 𝕨 and 𝕩 must have equal shapes (⟨3⟩ ≡ ≢𝕨, ⟨4⟩ ≡ ≢𝕩)</span>
<span class='String'>&quot;abc&quot;</span> <span class='Function'>⋈</span> <span class='String'>&quot;defg&quot;</span>
⟨ "abc" "defg" ⟩
diff --git a/docs/doc/pick.html b/docs/doc/pick.html
index d3166012..a5e9392b 100644
--- a/docs/doc/pick.html
+++ b/docs/doc/pick.html
@@ -57,9 +57,9 @@
</pre>
<p>If <code><span class='Value'>𝕩</span></code> is empty then First results in an error, like Pick.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqRICIiCuKKkSDiiaLPgA==">↗️</a><pre> <span class='Function'>⊑</span> <span class='String'>&quot;&quot;</span>
-ERROR
+<span class='Error'>Error: ⊑: Argument cannot be empty</span>
<span class='Function'>⊑</span> <span class='Function'>≢</span><span class='Number'>π</span>
-ERROR
+<span class='Error'>Error: ⊑: Argument cannot be empty</span>
</pre>
<p>In APL it's common to get the last element of a list with an idiom that translates to <code><span class='Function'>⊑⌽</span></code>, or First-<a href="reverse.html">Reverse</a>. In BQN the most straightforward way is to select with index <code><span class='Number'>¯1</span></code> instead. I also sometimes use <a href="fold.html">Fold</a> with the Right <a href="identity.html">identity function</a>.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqR4oy9ICJsYXN0IgrCrzHiipEgImxhc3QiCuKKosK0ICJsYXN0Ig==">↗️</a><pre> <span class='Function'>⊑⌽</span> <span class='String'>&quot;last&quot;</span>
@@ -84,7 +84,7 @@ ERROR
</pre>
<p>These indices have to be lists, since if they're numbers it just looks like <code><span class='Value'>𝕨</span></code> is one list index.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4p+oMiwxLDAswq8x4p+pIOKKkSAiYWJjIiAgIyDwnZWpIGRvZXNuJ3QgaGF2ZSByYW5rIDQhCgrin6gyLDEsMCzCrzHin6kg4qWKwqjiirjiipEgImFiYyIKCuKfqDIsMSwwLMKvMeKfqSDiio8gImFiYyIgICMgQmV0dGVyIHdheQ==">↗️</a><pre> <span class='Bracket'>⟨</span><span class='Number'>2</span><span class='Separator'>,</span><span class='Number'>1</span><span class='Separator'>,</span><span class='Number'>0</span><span class='Separator'>,</span><span class='Number'>¯1</span><span class='Bracket'>⟩</span> <span class='Function'>⊑</span> <span class='String'>&quot;abc&quot;</span> <span class='Comment'># 𝕩 doesn't have rank 4!
-</span>ERROR
+</span><span class='Error'>Error: ⊑: Picking item at wrong rank (index 2‿1‿0‿¯1 in array of shape ⟨3⟩)</span>
<span class='Bracket'>⟨</span><span class='Number'>2</span><span class='Separator'>,</span><span class='Number'>1</span><span class='Separator'>,</span><span class='Number'>0</span><span class='Separator'>,</span><span class='Number'>¯1</span><span class='Bracket'>⟩</span> <span class='Function'>⥊</span><span class='Modifier'>¨</span><span class='Modifier2'>⊸</span><span class='Function'>⊑</span> <span class='String'>&quot;abc&quot;</span>
"cbac"
@@ -124,5 +124,5 @@ ERROR
<span class='Bracket'>⟨⟨</span><span class='Number'>2</span><span class='Separator'>,</span><span class='Number'>3</span><span class='Bracket'>⟩</span><span class='Separator'>,</span><span class='Number'>1</span><span class='Bracket'>⟩</span> <span class='Function'>⊑</span> <span class='Value'>a</span> <span class='Comment'># 1 isn't a valid index
-</span>ERROR
+</span><span class='Error'>Error: ⊑: 𝕨 contained list with mixed-type elements</span>
</pre>
diff --git a/docs/doc/rebqn.html b/docs/doc/rebqn.html
index 9911d7c0..81a00418 100644
--- a/docs/doc/rebqn.html
+++ b/docs/doc/rebqn.html
@@ -46,7 +46,7 @@
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=ZG9Ob3Qg4oaQIOKAolJlQlFOIHtyZXBs4oeQImxvb3NlIn0KCkRvTm90ICJiIiAjIHN1cnByaXNlZCB3aGVuIHRoaXMgZmFpbHM=">↗️</a><pre> <span class='Value'>doNot</span> <span class='Gets'>←</span> <span class='Function'>•ReBQN</span> <span class='Brace'>{</span><span class='Value'>repl</span><span class='Gets'>⇐</span><span class='String'>&quot;loose&quot;</span><span class='Brace'>}</span>
<span class='Function'>DoNot</span> <span class='String'>&quot;b&quot;</span> <span class='Comment'># surprised when this fails
-</span>ERROR
+</span><span class='Error'>Error: Undefined identifier</span>
</pre>
<p>The difference in <code><span class='String'>&quot;strict&quot;</span></code> and <code><span class='String'>&quot;loose&quot;</span></code> is that a loose REPL can define a variable again, which just changes its value (under the covers, the <code><span class='Gets'>←</span></code> is treated as a <code><span class='Gets'>↩</span></code>).</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=RG8gImEg4oaQIMKvMSIKRG8gImEg4oaQIGLigL9hIgoKKOKAolJlQlFOIHtyZXBs4oeQInN0cmljdCJ9KeKOikDCqCAiYeKGkDEi4oC/ImHihpAyIiAgIyBTZWNvbmQgb25lIGVycm9ycw==">↗️</a><pre> <span class='Function'>Do</span> <span class='String'>&quot;a ← ¯1&quot;</span>
diff --git a/docs/doc/reshape.html b/docs/doc/reshape.html
index e9523103..2dbceced 100644
--- a/docs/doc/reshape.html
+++ b/docs/doc/reshape.html
@@ -147,7 +147,7 @@
⟨ 135 136 137 145 146 147 235 236 237 245 246 247 135 136 137 ⟩
<span class='Number'>4</span> <span class='Function'>⥊</span> <span class='Function'>↕</span><span class='Number'>0</span>
-ERROR
+<span class='Error'>Error: ⥊: Empty 𝕩 and non-empty result</span>
</pre>
<p>Reshape is the idiomatic way to make an array filled with a constant value (that is, where all elements are the same) when you know what shape it should have. For an atom element, reshape it directly; for an arbitrary element, first <a href="enclose.html">enclose</a> it to create a unit, and then reshape it.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=M+KAvzQg4qWKIDAKCjUg4qWKIDwgInN0cmluZyI=">↗️</a><pre> <span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>4</span> <span class='Function'>⥊</span> <span class='Number'>0</span>
@@ -181,7 +181,7 @@ ERROR
<p>These values are just BQN primitives of course. They're not called by Reshape or anything like that; the primitives are just chosen to suggest the corresponding functionality.</p>
<p>Here's an example of the four cases. If we try to turn five elements into two rows, <code><span class='Modifier2'>∘</span></code> gives an error, <code><span class='Function'>⌊</span></code> drops the last element, <code><span class='Function'>⌽</span></code> uses the first element again, and <code><span class='Function'>↑</span></code> uses a fill element (like <code><span class='Number'>6</span><span class='Function'>↑</span><span class='String'>&quot;abcde&quot;</span></code> would).</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MuKAv+KImCDipYogImFiY2RlIgoKMuKAv+KMiiDipYogImFiY2RlIgoKMuKAv+KMvSDipYogImFiY2RlIgoKMuKAv+KGkSDipYogImFiY2RlIg==">↗️</a><pre> <span class='Number'>2</span><span class='Ligature'>‿</span><span class='Modifier2'>∘</span> <span class='Function'>⥊</span> <span class='String'>&quot;abcde&quot;</span>
-ERROR
+<span class='Error'>Error: ⥊: Shape must be exact when reshaping with ∘</span>
<span class='Number'>2</span><span class='Ligature'>‿</span><span class='Function'>⌊</span> <span class='Function'>⥊</span> <span class='String'>&quot;abcde&quot;</span>
┌─
diff --git a/docs/doc/reverse.html b/docs/doc/reverse.html
index 49d52f50..c90f22f2 100644
--- a/docs/doc/reverse.html
+++ b/docs/doc/reverse.html
@@ -20,7 +20,7 @@
<span class='Function'>⌽</span> <span class='String'>'c'</span>
-ERROR
+<span class='Error'>Error: ⌽: Argument cannot be a unit</span>
</pre>
<p>You can't reverse an atom or rank-0 array because it has no axes to reverse along, or it could be said no ordering to reverse.</p>
<p>To reverse along an axis other than the first, use Cells (<code><span class='Modifier'>˘</span></code>) or Rank (<code><span class='Modifier2'>⎉</span></code>).</p>
@@ -62,7 +62,7 @@ ERROR
<span class='Number'>2</span> <span class='Function'>⌽</span> <span class='String'>'c'</span> <span class='Comment'># No axes to rotate
-</span>ERROR
+</span><span class='Error'>Error: ⌽: 𝕩 must have rank at least 1 for atom 𝕨</span>
</pre>
<p>Elements are always rotated to the left, so that entry <code><span class='Value'>i</span></code> of the result is entry <code><span class='Value'>𝕨</span><span class='Function'>+</span><span class='Value'>i</span></code> of the argument—or rather, entry <code><span class='Paren'>(</span><span class='Function'>≠</span><span class='Value'>𝕩</span><span class='Paren'>)</span><span class='Function'>|</span><span class='Value'>𝕨</span><span class='Function'>+</span><span class='Value'>i</span></code> to enable elements to cycle around. This can be seen directly by using the <a href="range.html">range</a> <code><span class='Function'>↕</span><span class='Value'>n</span></code> as an argument: then the value of <code><span class='Value'>𝕩</span></code> at index <code><span class='Value'>i</span></code> is just <code><span class='Value'>i</span></code>.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MiDijL0g4oaVNg==">↗️</a><pre> <span class='Number'>2</span> <span class='Function'>⌽</span> <span class='Function'>↕</span><span class='Number'>6</span>
@@ -91,7 +91,7 @@ ERROR
</pre>
<p>Rotate also allows <code><span class='Value'>𝕨</span></code> to be a list (or unit array) of integers, in which case they're matched with <a href="leading.html">leading axes</a> of <code><span class='Value'>𝕩</span></code>. This means the length of <code><span class='Value'>𝕨</span></code> can't be larger than the rank of <code><span class='Value'>𝕩</span></code>, or there wouldn't be enough axes to match. This rule also explains why <code><span class='Value'>𝕩</span></code> has to have rank one or more when <code><span class='Value'>𝕨</span></code> is an atom, because <code><span class='Value'>𝕨</span></code> is treated as the one-element list <code><span class='Function'>⥊</span><span class='Value'>𝕨</span></code> in that case.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=M+KAvzTigL8yIOKMvSAianVzdCBhIGxpc3Qi">↗️</a><pre> <span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>2</span> <span class='Function'>⌽</span> <span class='String'>&quot;just a list&quot;</span>
-ERROR
+<span class='Error'>Error: 𝕨⌽𝕩: Length of compound 𝕨 must be at most rank of 𝕩</span>
</pre>
<p>The expression below rotates the first (vertical) axis of <code><span class='Value'>tab</span></code> by one element, and second by two. So the line of capital letters goes from being one away from the top, up to the top, and the column with <code><span class='String'>'2'</span></code> goes from horizontal index 2 to index 0.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MeKAvzIg4oy9IHRhYg==">↗️</a><pre> <span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>2</span> <span class='Function'>⌽</span> <span class='Value'>tab</span>
diff --git a/docs/doc/select.html b/docs/doc/select.html
index 919a80c0..aaa36cc3 100644
--- a/docs/doc/select.html
+++ b/docs/doc/select.html
@@ -64,7 +64,7 @@
"two"
<span class='Number'>0</span> <span class='Function'>⊏</span> <span class='Function'>&lt;</span><span class='Number'>5</span> <span class='Comment'># No first axis to select from
-</span>ERROR
+</span><span class='Error'>Error: ⊏: 𝕩 cannot be a unit</span>
</pre>
<p>As a major cell of <code><span class='Value'>𝕩</span></code>, the result has rank one less than it and its shape is <code><span class='Number'>1</span><span class='Function'>↓≢</span><span class='Value'>𝕩</span></code>. <code><span class='Value'>𝕩</span></code> must have rank one or more.</p>
<p>The index <code><span class='Value'>𝕨</span></code> has to be an integer less than <code><span class='Function'>≠</span><span class='Value'>𝕩</span></code>. It can be negative, in which case it must be greater than or equal to <code><span class='Function'>-≠</span><span class='Value'>𝕩</span></code>. Negative indices select from the end of <code><span class='Value'>𝕩</span></code>, in that <code><span class='Number'>¯1</span></code> indicates the last major cell and <code><span class='Function'>-≠</span><span class='Value'>𝕩</span></code> indicates the first. If <code><span class='Function'>≠</span><span class='Value'>𝕩</span></code> is 0, then no index is valid.</p>
@@ -74,7 +74,7 @@
<span class='Number'>0</span> <span class='Function'>⊏</span> <span class='String'>&quot;&quot;</span>
-ERROR
+<span class='Error'>Error: ⊏: Indexing out-of-bounds (𝕨≡0, 0≡≠𝕩)</span>
</pre>
<p>The monadic case First Cell (<code><span class='Function'>⊏</span><span class='Value'>𝕩</span></code>) is identical to <code><span class='Number'>0</span><span class='Function'>⊏</span><span class='Value'>𝕩</span></code>. It has the same restrictions: <code><span class='Value'>𝕩</span></code> must have rank 1 or more, and length 1 or more.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqPICJhYmMiCgriio8gImFiYyLiiY0iZGVmIgoK4oqPIOKJjSAiYWJjIgoK4oqPICdhJw==">↗️</a><pre> <span class='Function'>⊏</span> <span class='String'>&quot;abc&quot;</span>
@@ -89,7 +89,7 @@ ERROR
"abc"
<span class='Function'>⊏</span> <span class='String'>'a'</span>
-ERROR
+<span class='Error'>Error: ⊏: Argument cannot be an atom</span>
</pre>
<h2 id="first-axis-selection"><a class="header" href="#first-axis-selection">First-axis selection</a></h2>
<p>If <code><span class='Value'>𝕨</span></code> is an array of numbers (including any empty array), then each number indicates a major cell of <code><span class='Value'>𝕩</span></code>. In the simplest case, a list of numbers gives a result with the same rank as <code><span class='Value'>𝕩</span></code> but maybe not the same length.</p>
diff --git a/docs/doc/undo.html b/docs/doc/undo.html
index 64d8ab53..f2082a10 100644
--- a/docs/doc/undo.html
+++ b/docs/doc/undo.html
@@ -38,7 +38,7 @@
<p>A few notable inverses are the <a href="arithmetic.html#basic-arithmetic">logarithm</a> <code><span class='Function'>⋆</span><span class='Modifier'>⁼</span></code>, <a href="transpose.html">un-Transpose</a> <code><span class='Function'>⍉</span><span class='Modifier'>⁼</span></code>, and <a href="replicate.html#inverse">Indices inverse</a> <code><span class='Function'>/</span><span class='Modifier'>⁼</span></code>. <a href="enclose.html">Enclose</a> inverse, <code><span class='Function'>&lt;</span><span class='Modifier'>⁼</span></code>, is an alternative to <a href="pick.html#first">First</a> that requires its argument to be a unit array.</p>
<p>Structural functions like <a href="take.html">Take</a> and <a href="shift.html">shifts</a> that remove elements from <code><span class='Value'>𝕩</span></code> can't be inverted, because given the result there's no way to know what the elements should be. However, there are two special cases that have inverses defined despite losing data: these are <code><span class='Function'>⊣</span><span class='Modifier'>⁼</span></code> and <code><span class='Value'>k</span><span class='Modifier'>⁼</span></code> where <code><span class='Value'>k</span></code> is a constant (a data type, or <code><span class='Value'>k</span><span class='Modifier'>˙</span></code>). For these, <code><span class='Value'>𝕩</span></code> is required to <a href="match.html">match</a> the always returned value <code><span class='Value'>𝕨</span></code> or <code><span class='Value'>k</span></code>, and this value is also used for the result—even though any result would be valid, as these functions ignore <code><span class='Value'>𝕩</span></code>.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MyDiiqPigbwgNAozIOKKo+KBvCAz">↗️</a><pre> <span class='Number'>3</span> <span class='Function'>⊣</span><span class='Modifier'>⁼</span> <span class='Number'>4</span>
-ERROR
+<span class='Error'>Error: ⁼: Inverse does not exist</span>
<span class='Number'>3</span> <span class='Function'>⊣</span><span class='Modifier'>⁼</span> <span class='Number'>3</span>
3
</pre>
diff --git a/docs/style.css b/docs/style.css
index 9adb848e..383c2b01 100644
--- a/docs/style.css
+++ b/docs/style.css
@@ -194,6 +194,7 @@ kbd {
.Number { color: #6f251f; }
.Comment { color: #32328b; }
.String { color: #2d7583; }
+.Error { color: #ee3030; }
a:link { color: #0b39dc; text-decoration-color: #0b39dc91; }
a:visited { color: #3d155f; }
@@ -229,6 +230,7 @@ a:visited { color: #3d155f; }
.Number { color: #a73227; }
.Comment { color: #3f3daa; }
.String { color: #3e99ab; }
+ .Error { color: #a50d0d; }
a:link { color: #5592d9; text-decoration-color: #508dd978; }
a:visited { color: #8781c1; }
diff --git a/docs/tutorial/list.html b/docs/tutorial/list.html
index 4df69829..35853585 100644
--- a/docs/tutorial/list.html
+++ b/docs/tutorial/list.html
@@ -338,7 +338,7 @@
</pre>
<p>Multiplication is harder, and if we try to multiply by the place value list directly it doesn't go so well.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=KOKMvTLii4bihpU4KSDDlyAnMCcgLcucICIwMTAwMTExMCLigL8iMDExMDAxMDEi4oC/IjAxMTEwMDEwIuKAvyIwMTEwMDEwMCLigL8iMDAxMDAwMDEi">↗️</a><pre> <span class='Paren'>(</span><span class='Function'>⌽</span><span class='Number'>2</span><span class='Function'>⋆↕</span><span class='Number'>8</span><span class='Paren'>)</span> <span class='Function'>×</span> <span class='String'>'0'</span> <span class='Function'>-</span><span class='Modifier'>˜</span> <span class='String'>&quot;01001110&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;01100101&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;01110010&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;01100100&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;00100001&quot;</span>
-ERROR
+<span class='Error'>Error: ×: Expected equal shape prefix (⟨8⟩ ≡ ≢𝕨, ⟨5⟩ ≡ ≢𝕩)</span>
</pre>
<p>This is because the list on the left has length 8 while the list on the right has length 5. The <em>elements</em> of the list on the right have length 8, but BQN can't be expected to know you want to connect the two arguments in that particular way. Especially considering that if you happen to have 8 characters then the right argument <em>will</em> have length 8!</p>
<p>There are a few ways to handle this. What we'll do is <em>bind</em> the place values to <code><span class='Function'>×</span></code> using the 2-modifier <code><span class='Modifier2'>⊸</span></code>. This modifier attaches a left argument to a function.</p>
diff --git a/docs/tutorial/variable.html b/docs/tutorial/variable.html
index 634bd5d5..16186db4 100644
--- a/docs/tutorial/variable.html
+++ b/docs/tutorial/variable.html
@@ -25,7 +25,7 @@
</pre>
<p>A variable can't be defined twice in the same <em>scope</em>. Later we'll work with functions and other pieces of code that create their own scopes, but for now all you need to know is that all the code in a tutorial runs in the same scope. So <code><span class='Value'>three</span></code> is already defined, and can't be defined again.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=dGhyZWUg4oaQIDQ=">↗️</a><pre> <span class='Value'>three</span> <span class='Gets'>←</span> <span class='Number'>4</span>
-ERROR
+<span class='Error'>Error: Redefinition</span>
</pre>
<p>It's a little crazy to call them variables if the definition can never change, right? Doesn't &quot;variable&quot; <em>mean</em> &quot;able to change&quot;? Fortunately, this is one way in which BQN isn't crazy. You can <em>modify</em> a variable's value with the arrow <code><span class='Gets'>↩</span></code> provided it's already been defined. This never does anything to the original value: that value stays the same; it's just (probably) not the value of the modified variable any more.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=dGhyZWUg4oapIDQKCnRocmVlID0gMyAgICMgV2FpdCB3aHkgZGlkIEkgZG8gdGhhdAoKMyA9IHRocmVlIOKGqSAzCgpmb3VyIOKGqSAzICAgICMgZm91ciBpc24ndCBkZWZpbmVkIHlldA==">↗️</a><pre> <span class='Value'>three</span> <span class='Gets'>↩</span> <span class='Number'>4</span>
@@ -37,12 +37,12 @@ ERROR
1
<span class='Value'>four</span> <span class='Gets'>↩</span> <span class='Number'>3</span> <span class='Comment'># four isn't defined yet
-</span>ERROR
+</span><span class='Error'>Error: Undefined identifier</span>
</pre>
<p>It's an odd distinction to have when your program is just one long sequence of statements, because there's only ever one arrow you can use: it just changes annoyingly after you define the variable for the first time. With multiple scopes this isn't the case: if you start a new scope inside another, then you'll still be able to use variables from the outside scope. Then <code><span class='Gets'>↩</span></code> lets you change the value of one of these variables while <code><span class='Gets'>←</span></code> allows you to define your own. If you're coming from a typical curly-brace language, you'd say that <code><span class='Gets'>←</span></code> both declares and assigns a variable, while <code><span class='Gets'>↩</span></code> only assigns it.</p>
<h2 id="variable-roles"><a class="header" href="#variable-roles">Variable roles</a></h2>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=QlFOIOKGkCAiW21hbnkgcGFnZXMgb2Ygc3BlY2lmaWNhdGlvbl0i">↗️</a><pre> <span class='Function'>BQN</span> <span class='Gets'>←</span> <span class='String'>&quot;[many pages of specification]&quot;</span>
-ERROR
+<span class='Error'>Error: Role of the two sides in assignment must match</span>
</pre>
<p>What's going on? Does BQN not know about capital letters? Does it object to self-reference? Why is &quot;<code><span class='Function'>BQN</span></code>&quot; green?</p>
<p>If you open that statement in the online REPL, you'll see the more informative message &quot;Role of the two sides in assignment must match&quot; (<em>assignment</em> means anything written with a leftward arrow—either definition or modification). This is still cryptic but at least a &quot;role&quot; is something we've heard about before.</p>
@@ -65,7 +65,7 @@ ERROR
-3{𝔽}
<span class='Function'>-</span> <span class='Modifier'>_three</span>
-ERROR
+<span class='Error'>Error: Interpreting non-1-modifier as 1-modifier</span>
</pre>
<p>Now might be a good time to <a href="expression.html#one-or-two-arguments">review</a> the earlier material on roles, experiment, and see if you can puzzle out what's happening here. Or a good time to keep reading until the horrifying distortions these texts inevitably wrap around your existence become apparent, so I'll explain that all these names do represent the same value—they all refer to the same variable—but they have different syntactic roles. Just as the same person might sometimes stand in front of the counter to order a coffee and sometimes stand behind it pouring coffee, the same variable is spelled different ways to indicate what it might be doing right now. There's a spelling for each role:</p>
<table>