aboutsummaryrefslogtreecommitdiff
path: root/docs/doc/match.html
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2022-07-14 21:02:14 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2022-07-14 21:08:18 -0400
commit5e81613ac137c5641675ceb792ca105d345d98c6 (patch)
treee91a84cbd337bb87161d68f45f981f73d4bdd0f5 /docs/doc/match.html
parente2b07a5fd0bbaad232c717fb90a31d6c61d72bd4 (diff)
Handle transitive dependencies in REPL link code
Diffstat (limited to 'docs/doc/match.html')
-rw-r--r--docs/doc/match.html2
1 files changed, 1 insertions, 1 deletions
diff --git a/docs/doc/match.html b/docs/doc/match.html
index 13568805..d5cddee2 100644
--- a/docs/doc/match.html
+++ b/docs/doc/match.html
@@ -92,7 +92,7 @@
⟨ 8 12 ⟩
</pre>
<p>These functions both have the definition <code><span class='Brace'>{</span><span class='Value'>a</span><span class='Function'>×</span><span class='Value'>𝕩</span><span class='Brace'>}</span></code>, but give different results! They are different <em>instances</em> of the same block, and have different environments: for <code><span class='Function'>T2</span></code>, <code><span class='Value'>a</span></code> is <code><span class='Number'>2</span></code>, and for <code><span class='Function'>T3</span></code>, it's <code><span class='Number'>3</span></code>.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=dDIg4oaQIEdlbiAyCnQzIOKGkCBHZW4gMwp0MiA9IHQz">↗️</a><pre> <span class='Value'>t2</span> <span class='Function'>=</span> <span class='Value'>t3</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=R2VuIOKGkCB7IGHihpDwnZWpIOKLhCB7YcOX8J2VqX0gfQp0MiDihpAgR2VuIDIKdDMg4oaQIEdlbiAzCnQyID0gdDM=">↗️</a><pre> <span class='Value'>t2</span> <span class='Function'>=</span> <span class='Value'>t3</span>
0
</pre>
<p>Some definitions should help to make things clearer. A &quot;block&quot; is not actually a BQN value, but a region of source code enclosed in <code><span class='Brace'>{}</span></code> brackets. When the program encounters a block function or modifier, it creates an instance of this block, and then uses this instance in the rest of the expression (actually, an immediate block also creates an instance, but this instance is immediately run, and discarded when it finishes, so it can't be accessed as a value). Every time the function <code><span class='Function'>Gen</span></code> is run, it evaluates the statements it contains, and the second statement <code><span class='Brace'>{</span><span class='Value'>a</span><span class='Function'>×</span><span class='Value'>𝕩</span><span class='Brace'>}</span></code> creates a block instance. So <code><span class='Function'>Gen</span></code> creates a new block instance each time. This is necessary for <code><span class='Function'>Gen</span></code> to work correctly: each time it runs, it creates a new scope, so it needs to create a new function that will be tied to that scope.</p>