aboutsummaryrefslogtreecommitdiff
path: root/docs/doc/hook.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doc/hook.html')
-rw-r--r--docs/doc/hook.html12
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/doc/hook.html b/docs/doc/hook.html
index e300796a..a81c7b7d 100644
--- a/docs/doc/hook.html
+++ b/docs/doc/hook.html
@@ -102,7 +102,7 @@
</tbody>
</table>
<h2 id="description"><a class="header" href="#description">Description</a></h2>
-<p>In the general case, I think of Before as using <code><span class='Function'>𝔽</span></code> as a preprocessing function applied to <code><span class='Value'>𝕨</span></code> (when there are two arguments) and After as using <code><span class='Function'>𝔾</span></code> as preprocessing for <code><span class='Value'>𝕩</span></code>. Then the other operand is called on the result and remaining argument. Here are some simple calls with Pair (<code><span class='Function'>⋈</span></code>): the result is a pair that corresponds to <code><span class='Value'>𝕨</span><span class='Ligature'>‿</span><span class='Value'>𝕩</span></code>, but one or the other result has been modified by the pointy-side function.</p>
+<p>In the general case, I think of Before as using <code><span class='Function'>𝔽</span></code> as a preprocessing function applied to <code><span class='Value'>𝕨</span></code> (when there are two arguments), and After as using <code><span class='Function'>𝔾</span></code> as preprocessing for <code><span class='Value'>𝕩</span></code>. Then the other operand is called on the result and remaining argument. Here are some simple calls with <a href="pair.html">Pair</a> (<code><span class='Function'>⋈</span></code>): the result is a pair that corresponds to <code><span class='Value'>𝕨</span><span class='Ligature'>‿</span><span class='Value'>𝕩</span></code>, but one or the other result has been modified by the pointy-side function.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=OSDiiJriirjii4ggMgoKOSDii4jin5zihpUgMg==">↗️</a><pre> <span class='Number'>9</span> <span class='Function'>√</span><span class='Modifier2'>⊸</span><span class='Function'>⋈</span> <span class='Number'>2</span>
⟨ 3 2 ⟩
@@ -117,7 +117,7 @@
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=e/Cdlak8MH3CqOKKuC8gNOKAv8KvMuKAvzHigL/CrzPigL/CrzM=">↗️</a><pre> <span class='Brace'>{</span><span class='Value'>𝕩</span><span class='Function'>&lt;</span><span class='Number'>0</span><span class='Brace'>}</span><span class='Modifier'>¨</span><span class='Modifier2'>⊸</span><span class='Function'>/</span> <span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>¯2</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>¯3</span><span class='Ligature'>‿</span><span class='Number'>¯3</span>
⟨ ¯2 ¯3 ¯3 ⟩
</pre>
-<p>As <code><span class='Function'>&lt;</span></code> is a pervasive function, there's no need for the Each (<code><span class='Modifier'>¨</span></code>) in this case, and the clunky block function <code><span class='Brace'>{</span><span class='Value'>𝕩</span><span class='Function'>&lt;</span><span class='Number'>0</span><span class='Brace'>}</span></code> can also be written smaller with a combinator, as <code><span class='Function'>&lt;</span><span class='Modifier2'>⟜</span><span class='Number'>0</span></code>. More on that in the next section…</p>
+<p>As <code><span class='Function'>&lt;</span></code> is a <a href="arithmetic.html#pervasion">pervasive</a> function, there's no need for the Each (<code><span class='Modifier'>¨</span></code>) in this case, and the clunky block function <code><span class='Brace'>{</span><span class='Value'>𝕩</span><span class='Function'>&lt;</span><span class='Number'>0</span><span class='Brace'>}</span></code> can also be written smaller with a combinator, as <code><span class='Function'>&lt;</span><span class='Modifier2'>⟜</span><span class='Number'>0</span></code>. More on that in the next section…</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=POKfnDDiirgvIDTigL/CrzLigL8x4oC/wq8z4oC/wq8z">↗️</a><pre> <span class='Function'>&lt;</span><span class='Modifier2'>⟜</span><span class='Number'>0</span><span class='Modifier2'>⊸</span><span class='Function'>/</span> <span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>¯2</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>¯3</span><span class='Ligature'>‿</span><span class='Number'>¯3</span>
⟨ ¯2 ¯3 ¯3 ⟩
</pre>
@@ -126,7 +126,7 @@
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=POKfnDAgIDTigL/CrzLigL8x4oC/wq8z4oC/wq8z">↗️</a><pre> <span class='Function'>&lt;</span><span class='Modifier2'>⟜</span><span class='Number'>0</span> <span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>¯2</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>¯3</span><span class='Ligature'>‿</span><span class='Number'>¯3</span>
⟨ 0 1 0 1 1 ⟩
</pre>
-<p>If we expand <code><span class='Function'>&lt;</span><span class='Modifier2'>⟜</span><span class='Number'>0</span> <span class='Value'>x</span></code>, we get <code><span class='Value'>x</span> <span class='Function'>&lt;</span> <span class='Paren'>(</span><span class='Number'>0</span> <span class='Value'>x</span><span class='Paren'>)</span></code>, which doesn't quite make sense. That's because <code><span class='Number'>0</span></code> has a subject role, but <code><span class='Modifier2'>⟜</span></code> always applies its operands as functions. It's more accurate to use <code><span class='Value'>x</span> <span class='Function'>&lt;</span> <span class='Paren'>(</span><span class='Number'>0</span><span class='Brace'>{</span><span class='Function'>𝔽</span><span class='Brace'>}</span> <span class='Value'>x</span><span class='Paren'>)</span></code>, or just skip ahead to <code><span class='Value'>x</span> <span class='Function'>&lt;</span> <span class='Number'>0</span></code>.</p>
+<p>If we expand <code><span class='Function'>&lt;</span><span class='Modifier2'>⟜</span><span class='Number'>0</span> <span class='Value'>x</span></code>, we get <code><span class='Value'>x</span> <span class='Function'>&lt;</span> <span class='Paren'>(</span><span class='Number'>0</span> <span class='Value'>x</span><span class='Paren'>)</span></code>, which doesn't quite make sense. That's because <code><span class='Number'>0</span></code> has a subject <a href="expression.html#syntactic-role">role</a>, but <code><span class='Modifier2'>⟜</span></code> always applies its operands as functions. It's more accurate to use <code><span class='Value'>x</span> <span class='Function'>&lt;</span> <span class='Paren'>(</span><span class='Number'>0</span><span class='Brace'>{</span><span class='Function'>𝔽</span><span class='Brace'>}</span> <span class='Value'>x</span><span class='Paren'>)</span></code>, or just skip ahead to <code><span class='Value'>x</span> <span class='Function'>&lt;</span> <span class='Number'>0</span></code>.</p>
<p>Similar reasoning gives the following expansions:</p>
<table>
<thead>
@@ -150,7 +150,7 @@
</tbody>
</table>
<p>Note that when there are two arguments, the constant &quot;swallows&quot; the one on the same side, so that the function is applied to the constant and the argument on the <em>opposite</em> side.</p>
-<p>As in a train, if you want to use a function as a constant then you need to be explicity about it, with the <a href="constant.html">Constant</a> (<code><span class='Modifier'>˙</span></code>) modifier.</p>
+<p>As in a train, if you want to use a function as a constant then you need to be explicit about it, with the <a href="constant.html">Constant</a> (<code><span class='Modifier'>˙</span></code>) modifier.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MyDii4jin5wo4oyKy5kp4oq44qWKICdhJyvihpUxMg==">↗️</a><pre> <span class='Number'>3</span> <span class='Function'>⋈</span><span class='Modifier2'>⟜</span><span class='Paren'>(</span><span class='Function'>⌊</span><span class='Modifier'>˙</span><span class='Paren'>)</span><span class='Modifier2'>⊸</span><span class='Function'>⥊</span> <span class='String'>'a'</span><span class='Function'>+↕</span><span class='Number'>12</span>
┌─
╵"abcd
@@ -161,7 +161,7 @@
<p>In the more extreme case of wanting a <em>modifier</em> operand, you might try <code><span class='Function'>⋈</span><span class='Modifier2'>⟜</span><span class='Paren'>(</span><span class='Brace'>{</span><span class='Modifier2'>∘</span><span class='Brace'>}</span><span class='Modifier'>˙</span><span class='Paren'>)</span><span class='Modifier2'>⊸</span><span class='Function'>⥊</span></code>, or <code><span class='Paren'>(</span><span class='Function'>⊣⋈</span><span class='Brace'>{</span><span class='Modifier2'>∘</span><span class='Brace'>}</span><span class='Modifier'>˙</span><span class='Paren'>)</span><span class='Modifier2'>⊸</span><span class='Function'>⥊</span></code>, or just cheat with <code><span class='Function'>∾</span><span class='Modifier2'>⟜</span><span class='Bracket'>⟨</span><span class='Modifier2'>∘</span><span class='Bracket'>⟩</span><span class='Modifier2'>⊸</span><span class='Function'>⥊</span></code>.</p>
<h2 id="combinations"><a class="header" href="#combinations">Combinations</a></h2>
<p>If you like to go <a href="tacit.html">tacit</a>, you'll likely end up stringing together a few <code><span class='Modifier2'>⊸</span></code>s and <code><span class='Modifier2'>⟜</span></code>s at times. Of course the effects are entirely determined by the left-to-right precedence rule for modifiers, but it's interesting to examine what happens in more detail.</p>
-<p>In the pattern <code><span class='Function'>F</span><span class='Modifier2'>⊸</span><span class='Function'>G</span><span class='Modifier2'>⟜</span><span class='Function'>H</span></code>, the ordering doesn't matter at all! That is, it means <code><span class='Paren'>(</span><span class='Function'>F</span><span class='Modifier2'>⊸</span><span class='Function'>G</span><span class='Paren'>)</span><span class='Modifier2'>⟜</span><span class='Function'>H</span></code>, but this is exactly the same function as <code><span class='Function'>F</span><span class='Modifier2'>⊸</span><span class='Paren'>(</span><span class='Function'>G</span><span class='Modifier2'>⟜</span><span class='Function'>H</span><span class='Paren'>)</span></code>. In both cases, <code><span class='Function'>F</span></code> is applied to <code><span class='Value'>𝕨</span></code>, <code><span class='Function'>H</span></code> is applied to <code><span class='Value'>𝕩</span></code>, and <code><span class='Function'>G</span></code> acts on both the results.</p>
+<p>In the pattern <code><span class='Function'>F</span><span class='Modifier2'>⊸</span><span class='Function'>G</span><span class='Modifier2'>⟜</span><span class='Function'>H</span></code>, the ordering doesn't matter at all! That is, it means <code><span class='Paren'>(</span><span class='Function'>F</span><span class='Modifier2'>⊸</span><span class='Function'>G</span><span class='Paren'>)</span><span class='Modifier2'>⟜</span><span class='Function'>H</span></code>, but this is the same function as <code><span class='Function'>F</span><span class='Modifier2'>⊸</span><span class='Paren'>(</span><span class='Function'>G</span><span class='Modifier2'>⟜</span><span class='Function'>H</span><span class='Paren'>)</span></code>. In both cases, <code><span class='Function'>F</span></code> is applied to <code><span class='Value'>𝕨</span></code>, <code><span class='Function'>H</span></code> is applied to <code><span class='Value'>𝕩</span></code>, and <code><span class='Function'>G</span></code> acts on both the results (the parentheses do change whether <code><span class='Function'>F</span></code> or <code><span class='Function'>H</span></code> is called first, which only matters if they have side effects).</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=NCAt4oq44ouI4p+c4ouGIDI=">↗️</a><pre> <span class='Number'>4</span> <span class='Function'>-</span><span class='Modifier2'>⊸</span><span class='Function'>⋈</span><span class='Modifier2'>⟜</span><span class='Function'>⋆</span> <span class='Number'>2</span>
⟨ ¯4 7.38905609893065 ⟩
</pre>
@@ -187,4 +187,4 @@
<span class='Paren'>(</span><span class='Function'>⌊≠÷</span><span class='Number'>2</span><span class='Modifier'>˙</span><span class='Paren'>)</span><span class='Modifier2'>⊸</span><span class='Function'>⊑</span><span class='Modifier2'>⊸</span><span class='Function'>≤</span><span class='Modifier2'>⊸</span><span class='Function'>⊔</span> <span class='String'>&quot;quicksort&quot;</span> <span class='Comment'># Use to partition 𝕩
</span>⟨ "ic" "quksort" ⟩
</pre>
-<p>Three is rare, but I use two <code><span class='Modifier2'>⊸</span></code>s all the time, as well as <code><span class='Modifier2'>⟜</span></code> followed by <code><span class='Modifier2'>⊸</span></code>, for example the <code><span class='Function'>&lt;</span><span class='Modifier2'>⟜</span><span class='String'>'a'</span><span class='Modifier2'>⊸</span><span class='Function'>/</span></code> filter on the <a href="../index.html">front page</a>. I think a combination like <code><span class='Value'>lots</span><span class='Modifier2'>∘</span><span class='Value'>of</span><span class='Modifier2'>○</span><span class='Value'>stuff</span><span class='Modifier2'>⊸</span><span class='Function'>/</span> <span class='Value'>x</span></code> reads very nicely when moving from left to right. When I see <code><span class='Modifier2'>⊸</span><span class='Function'>/</span></code> I know that I'm filtering <code><span class='Value'>x</span></code> and can read the rest with that context. The reason <code><span class='Modifier2'>⊸</span></code> that has all this power, but not <code><span class='Modifier2'>⟜</span></code>, has nothing to do with the modifiers themselves, as they're completely symmetrical. It's all in the way BQN defines modifier grammar, left to right.</p>
+<p>Three is rare, but I use two <code><span class='Modifier2'>⊸</span></code>s all the time, as well as <code><span class='Modifier2'>⟜</span></code> followed by <code><span class='Modifier2'>⊸</span></code>, for example the <code><span class='Function'>&lt;</span><span class='Modifier2'>⟜</span><span class='String'>'a'</span><span class='Modifier2'>⊸</span><span class='Function'>/</span></code> filter on the <a href="../index.html">front page</a>. I think a combination like <code><span class='Value'>lots</span><span class='Modifier2'>∘</span><span class='Value'>of</span><span class='Modifier2'>○</span><span class='Value'>stuff</span><span class='Modifier2'>⊸</span><span class='Function'>/</span> <span class='Value'>x</span></code> reads very nicely when moving from right to left. When I see <code><span class='Modifier2'>⊸</span><span class='Function'>/</span></code> I know that I'm filtering <code><span class='Value'>x</span></code> and can read the rest with that context. The reason <code><span class='Modifier2'>⊸</span></code> has all this power, but not <code><span class='Modifier2'>⟜</span></code>, has nothing to do with the modifiers themselves, as they're completely symmetrical. It's all in the way BQN defines modifier grammar, left to right.</p>