aboutsummaryrefslogtreecommitdiff
path: root/docs/doc/swap.html
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2022-06-10 22:42:44 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2022-06-10 22:42:44 -0400
commitf469c6f9bd4c9cf3c2b8ce93c3f2331cdcdd589a (patch)
treeac35ee6715ad4298bd725b4837631139f40ce122 /docs/doc/swap.html
parent189e020069d5225c349b15837a65dd08035c97aa (diff)
More editing
Diffstat (limited to 'docs/doc/swap.html')
-rw-r--r--docs/doc/swap.html8
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/doc/swap.html b/docs/doc/swap.html
index 190b0d0a..409de900 100644
--- a/docs/doc/swap.html
+++ b/docs/doc/swap.html
@@ -54,8 +54,8 @@
</tr>
</tbody>
</table>
-<p>Since <code><span class='Value'>๐•ฉ</span></code> is always the left argument, these two definitions can be unified as <code><span class='Brace'>{</span><span class='Value'>๐•ฉ</span><span class='Function'>๐”ฝ</span><span class='Value'>๐•จ</span><span class='Function'>โŠฃ</span><span class='Value'>๐•ฉ</span><span class='Brace'>}</span></code>, noting that <a href="identity.html">Left</a> becomes a plain identity function when the left argument <code><span class='Value'>๐•จ</span></code> isn't given.</p>
-<p>Swap is arguably less transformative. Some common examples are <code><span class='Function'>-</span><span class='Modifier'>หœ</span></code> and <code><span class='Function'>รท</span><span class='Modifier'>หœ</span></code>, since these two functions run the <a href="../commentary/problems.html#subtraction-division-and-span-are-backwards">wrong way</a> for BQN's evaluation order. This is very often useful in <a href="tacit.html">tacit</a> programming, and less useful for explicit code. While it sometimes allows for shorter code by making a pair of parentheses unnecessary (say, <code><span class='Paren'>(</span><span class='Value'>a</span><span class='Function'>ร—</span><span class='Value'>b</span><span class='Paren'>)</span><span class='Function'>-</span><span class='Value'>c</span></code> is <code><span class='Value'>c</span><span class='Function'>-</span><span class='Modifier'>หœ</span><span class='Value'>a</span><span class='Function'>ร—</span><span class='Value'>b</span></code>), I personally don't think this is always a good idea. My opinion is that it should be used when it makes the semantics a better fit for BQN, but putting the primary argument on the right and a secondary or control argument on the left.</p>
+<p>Since <code><span class='Value'>๐•ฉ</span></code> always becomes the left argument, these two definitions can be unified as <code><span class='Brace'>{</span><span class='Value'>๐•ฉ</span><span class='Function'>๐”ฝ</span><span class='Value'>๐•จ</span><span class='Function'>โŠฃ</span><span class='Value'>๐•ฉ</span><span class='Brace'>}</span></code>, noting that <a href="identity.html">Left</a> returns <code><span class='Value'>๐•จ</span></code> if it's given and <code><span class='Value'>๐•ฉ</span></code> if not.</p>
+<p>Swap is arguably less transformative. Some common examples are <code><span class='Function'>-</span><span class='Modifier'>หœ</span></code> and <code><span class='Function'>รท</span><span class='Modifier'>หœ</span></code>, since these two functions run the <a href="../commentary/problems.html#subtraction-division-and-span-are-backwards">wrong way</a> for BQN's evaluation order. This is very often useful in <a href="tacit.html">tacit</a> programming, and less needed for explicit code. While it sometimes allows for shorter code by making a pair of parentheses unnecessary (say, <code><span class='Paren'>(</span><span class='Value'>a</span><span class='Function'>ร—</span><span class='Value'>b</span><span class='Paren'>)</span><span class='Function'>-</span><span class='Value'>c</span></code> is <code><span class='Value'>c</span><span class='Function'>-</span><span class='Modifier'>หœ</span><span class='Value'>a</span><span class='Function'>ร—</span><span class='Value'>b</span></code>), I personally don't think this is always a good idea. My opinion is that it should be used when it makes the semantics a better fit for BQN, but putting the primary argument on the right and a secondary or control argument on the left.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=J2EnIOKLiMucICdiJwoKIiArIiDiio/LnCAw4oC/MeKAvzHigL8w4oC/MOKJjTHigL8w4oC/MeKAvzDigL8x">โ†—๏ธ</a><pre> <span class='String'>'a'</span> <span class='Function'>โ‹ˆ</span><span class='Modifier'>หœ</span> <span class='String'>'b'</span>
"ba"
@@ -65,7 +65,7 @@
+ + +"
โ”˜
</pre>
-<p>Self re-uses one argument twice. In this way it's a little like <a href="compose.html">Over</a>, which re-uses one <em>function</em> twice. A common combination is with Table, <code><span class='Modifier'>โŒœหœ</span></code>, so that the operand function is called on each combination of elements from the argument to form a square result. For example, <code><span class='Function'>=</span><span class='Modifier'>โŒœหœ</span></code> applied to <code><span class='Function'>โ†•</span><span class='Value'>n</span></code> gives the identity matrix of size <code><span class='Value'>n</span></code>.</p>
+<p>Moving on, Self re-uses one argument twice. In this way it's a little like <a href="compose.html">Over</a>, which re-uses one <em>function</em> twice. A common combination is with <a href="map.html#table">Table</a>, <code><span class='Modifier'>โŒœหœ</span></code>, so that the operand function is called on each combination of elements in <code><span class='Value'>๐•ฉ</span></code> to form a square result. For example, <code><span class='Function'>=</span><span class='Modifier'>โŒœหœ</span></code> applied to <code><span class='Function'>โ†•</span><span class='Value'>n</span></code> gives the identity matrix of size <code><span class='Value'>n</span></code>.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=w5fLnCA0Cgo94oycy5wg4oaVMw==">โ†—๏ธ</a><pre> <span class='Function'>ร—</span><span class='Modifier'>หœ</span> <span class='Number'>4</span>
16
@@ -76,4 +76,4 @@
0 0 1
โ”˜
</pre>
-<p>Note that Self isn't needed with Before (<code><span class='Modifier2'>โŠธ</span></code>) and After (<code><span class='Modifier2'>โŸœ</span></code>), which essentially have a copy built in: for example <code><span class='Function'>F</span><span class='Modifier2'>โŠธ</span><span class='Function'>G</span> <span class='Value'>๐•ฉ</span></code> is the same as <code><span class='Function'>F</span><span class='Modifier2'>โŠธ</span><span class='Function'>G</span><span class='Modifier'>หœ</span> <span class='Value'>๐•ฉ</span></code> by definition.</p>
+<p>Note that Self isn't needed with <a href="hook.html">Before</a> (<code><span class='Modifier2'>โŠธ</span></code>) <a href="hook.html">and After</a> (<code><span class='Modifier2'>โŸœ</span></code>), which essentially have a copy built in: for example <code><span class='Function'>F</span><span class='Modifier2'>โŠธ</span><span class='Function'>G</span> <span class='Value'>๐•ฉ</span></code> is the same as <code><span class='Function'>F</span><span class='Modifier2'>โŠธ</span><span class='Function'>G</span><span class='Modifier'>หœ</span> <span class='Value'>๐•ฉ</span></code> by definition.</p>