aboutsummaryrefslogtreecommitdiff
path: root/docs/doc/functional.html
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2022-07-14 20:06:50 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2022-07-14 20:06:50 -0400
commite2b07a5fd0bbaad232c717fb90a31d6c61d72bd4 (patch)
tree8cd1d594838a87f4257e73d1e0e32d69ec4a148c /docs/doc/functional.html
parentfe13f4a775a83073cb44d8e47ec4fdf9ec957bed (diff)
Try to include previous variable definitions in REPL links
Diffstat (limited to 'docs/doc/functional.html')
-rw-r--r--docs/doc/functional.html12
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/doc/functional.html b/docs/doc/functional.html
index f3eea496..bec89fee 100644
--- a/docs/doc/functional.html
+++ b/docs/doc/functional.html
@@ -76,31 +76,31 @@
<span class='Brace'>}</span>
</pre>
<p>We can pass it the <a href="arithmetic.html#basic-arithmetic">exponential</a> function as an argument by giving it the name <code><span class='Function'>Exp</span></code> and then referring to it in lowercase (that is, in a subject role). The result is a <a href="train.html">train</a> that adds 1 to <em>e</em>-1 times the argument (we'll discuss only tacit functions here; for blocks see <a href="lexical.html">lexical scoping</a>).</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=RXhwIOKGkCDii4YKTGluIGV4cA==">↗️</a><pre> <span class='Function'>Exp</span> <span class='Gets'>←</span> <span class='Function'>⋆</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=TGluIOKGkCB7CiAgdjAg4oaQIPCdlY8gMAogIHYwICsgKCjwnZWPIDEpIC0gdjApIMOXIOKKogp9CkV4cCDihpAg4ouGCkxpbiBleHA=">↗️</a><pre> <span class='Function'>Exp</span> <span class='Gets'>←</span> <span class='Function'>⋆</span>
<span class='Function'>Lin</span> <span class='Value'>exp</span>
1+1.718281828459045×⊢
</pre>
<p>As with all functions, the result of <code><span class='Function'>Lin</span></code> has a subject role. To use it as a function, we give it a name and then use that name with an uppercase spelling.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=ZXhwTGluIOKGkCBMaW4gZXhwCkV4cExpbiA1">↗️</a><pre> <span class='Value'>expLin</span> <span class='Gets'>←</span> <span class='Function'>Lin</span> <span class='Value'>exp</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=TGluIOKGkCB7CiAgdjAg4oaQIPCdlY8gMAogIHYwICsgKCjwnZWPIDEpIC0gdjApIMOXIOKKogp9CkV4cCDihpAg4ouGCmV4cExpbiDihpAgTGluIGV4cApFeHBMaW4gNQ==">↗️</a><pre> <span class='Value'>expLin</span> <span class='Gets'>←</span> <span class='Function'>Lin</span> <span class='Value'>exp</span>
<span class='Function'>ExpLin</span> <span class='Number'>5</span>
9.591409142295225
</pre>
<p>A tricker but more compact method is to use the 1-modifier <code><span class='Brace'>{</span><span class='Function'>𝔽</span><span class='Brace'>}</span></code>, as a modifier's operand can have a subject or function role but its output always has a function role.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=KExpbiBleHApe/CdlL19IDU=">↗️</a><pre> <span class='Paren'>(</span><span class='Function'>Lin</span> <span class='Value'>exp</span><span class='Paren'>)</span><span class='Brace'>{</span><span class='Function'>𝔽</span><span class='Brace'>}</span> <span class='Number'>5</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=TGluIOKGkCB7CiAgdjAg4oaQIPCdlY8gMAogIHYwICsgKCjwnZWPIDEpIC0gdjApIMOXIOKKogp9CkV4cCDihpAg4ouGCihMaW4gZXhwKXvwnZS9fSA1">↗️</a><pre> <span class='Paren'>(</span><span class='Function'>Lin</span> <span class='Value'>exp</span><span class='Paren'>)</span><span class='Brace'>{</span><span class='Function'>𝔽</span><span class='Brace'>}</span> <span class='Number'>5</span>
9.591409142295225
</pre>
<p>Not the most accurate approximation, though.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=RXhwIDU=">↗️</a><pre> <span class='Function'>Exp</span> <span class='Number'>5</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=RXhwIOKGkCDii4YKRXhwIDU=">↗️</a><pre> <span class='Function'>Exp</span> <span class='Number'>5</span>
148.4131591025766
</pre>
<p>Note also in this case that we could have used a modifier with a very similar definition to <code><span class='Function'>Lin</span></code>. The modifier is identical in definition except that <code><span class='Function'>𝕏</span></code> is replaced with <code><span class='Function'>𝔽</span></code>.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=X2xpbiDihqkgewogIHYwIOKGkCDwnZS9IDAKICB2MCArICgo8J2UvSAxKSAtIHYwKSDDlyDiiqIKfQ==">↗️</a><pre> <span class='Modifier'>_lin</span> <span class='Gets'>↩</span> <span class='Brace'>{</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=TGluIOKGkCB7CiAgdjAg4oaQIPCdlY8gMAogIHYwICsgKCjwnZWPIDEpIC0gdjApIMOXIOKKogp9Cl9saW4g4oapIHsKICB2MCDihpAg8J2UvSAwCiAgdjAgKyAoKPCdlL0gMSkgLSB2MCkgw5cg4oqiCn0=">↗️</a><pre> <span class='Modifier'>_lin</span> <span class='Gets'>↩</span> <span class='Brace'>{</span>
<span class='Value'>v0</span> <span class='Gets'>←</span> <span class='Function'>𝔽</span> <span class='Number'>0</span>
<span class='Value'>v0</span> <span class='Function'>+</span> <span class='Paren'>((</span><span class='Function'>𝔽</span> <span class='Number'>1</span><span class='Paren'>)</span> <span class='Function'>-</span> <span class='Value'>v0</span><span class='Paren'>)</span> <span class='Function'>×</span> <span class='Function'>⊢</span>
<span class='Brace'>}</span>
</pre>
<p>Its call syntax is simpler as well. In other cases, however, the function version might be preferable, for example when dealing with arrays of functions or many arguments including a function.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=RXhwIF9saW4gNQ==">↗️</a><pre> <span class='Function'>Exp</span> <span class='Modifier'>_lin</span> <span class='Number'>5</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=TGluIOKGkCB7CiAgdjAg4oaQIPCdlY8gMAogIHYwICsgKCjwnZWPIDEpIC0gdjApIMOXIOKKogp9CkV4cCDihpAg4ouGCl9saW4g4oapIHsKICB2MCDihpAg8J2UvSAwCiAgdjAgKyAoKPCdlL0gMSkgLSB2MCkgw5cg4oqiCn0KRXhwIF9saW4gNQ==">↗️</a><pre> <span class='Function'>Exp</span> <span class='Modifier'>_lin</span> <span class='Number'>5</span>
9.591409142295225
</pre>
<h3 id="arrays-of-functions"><a class="header" href="#arrays-of-functions">Arrays of functions</a></h3>