aboutsummaryrefslogtreecommitdiff
path: root/docs/doc/order.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/order.html
parentfe13f4a775a83073cb44d8e47ec4fdf9ec957bed (diff)
Try to include previous variable definitions in REPL links
Diffstat (limited to 'docs/doc/order.html')
-rw-r--r--docs/doc/order.html6
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/doc/order.html b/docs/doc/order.html
index 15111965..050b6763 100644
--- a/docs/doc/order.html
+++ b/docs/doc/order.html
@@ -79,7 +79,7 @@
⟨ 3 1 0 2 ⟩
</pre>
<p>Given our list <code><span class='Value'>l</span></code> of things in a solar system, Sort Up orders them by size, or maybe alphabetically. What does <code><span class='Function'>⍋</span><span class='Value'>l</span></code> do? Its result also orders these items, but instead of listing them directly, each element is the <em>index</em> of that cell in the argument. So the way to read it is that the first item in sorted order is cell <code><span class='Number'>3</span></code> of the argument, <code><span class='String'>&quot;asteroid&quot;</span></code>. The second is cell <code><span class='Number'>1</span></code>, <code><span class='String'>&quot;moon&quot;</span></code>, and the third—forget this, we made programming languages for a reason.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=KOKNi2wpIOKKjyBs">↗️</a><pre> <span class='Paren'>(</span><span class='Function'>⍋</span><span class='Value'>l</span><span class='Paren'>)</span> <span class='Function'>⊏</span> <span class='Value'>l</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIGwg4oaQICJwbGFuZXQi4oC/Im1vb24i4oC/InN0YXIi4oC/ImFzdGVyb2lkIgoo4o2LbCkg4oqPIGw=">↗️</a><pre> <span class='Paren'>(</span><span class='Function'>⍋</span><span class='Value'>l</span><span class='Paren'>)</span> <span class='Function'>⊏</span> <span class='Value'>l</span>
⟨ "asteroid" "moon" "planet" "star" ⟩
</pre>
<h3 id="ordinals"><a class="header" href="#ordinals">Ordinals</a></h3>
@@ -145,7 +145,7 @@
</svg>
<p>So the elements of the Grade of an array correspond to the cells of that array after it's sorted. It's tempting if you don't have the sorted list handy to try to match them up with major cells of the original array, but this never makes sense—there's no relationship. However, applying Grade <em>twice</em> gives us a list that does correspond to the original argument quite usefully: it says, for each major cell of that argument, what rank it has relative to the others (smallest is 0, next is 1, and so on, breaking ties in favor of which cell comes earlier in the argument). Experienced APL programmers call this pattern the &quot;ordinals&quot; idiom.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=bCDiiY0g4o2L4o2LIGw=">↗️</a><pre> <span class='Value'>l</span> <span class='Function'>≍</span> <span class='Function'>⍋⍋</span> <span class='Value'>l</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIGwg4oaQICJwbGFuZXQi4oC/Im1vb24i4oC/InN0YXIi4oC/ImFzdGVyb2lkIgpsIOKJjSDijYvijYsgbA==">↗️</a><pre> <span class='Value'>l</span> <span class='Function'>≍</span> <span class='Function'>⍋⍋</span> <span class='Value'>l</span>
┌─
╵ "planet" "moon" "star" "asteroid"
2 1 3 0
@@ -176,7 +176,7 @@
</pre>
<p>Here we order a table by its second column. Maybe in this case it's not a problem if &quot;dog&quot; and &quot;pig&quot; trade places. But unpredictability is never good—would you get the same results with a different implementation of BQN? And for many other applications of Grade the ordering of equal elements is important. So BQN specifies that matching cells are always ordered by their indices. The same rule applies for Grade Down, so that for example the grade in <em>either</em> direction of an array <code><span class='Value'>𝕩</span></code> where all cells are the same is <code><span class='Function'>↕≠</span><span class='Value'>𝕩</span></code>. One effect is that <code><span class='Function'>⍋</span><span class='Value'>𝕩</span></code> is not always the same as <code><span class='Function'>⌽⍒</span><span class='Value'>𝕩</span></code>, even though <code><span class='Function'>∧</span><span class='Value'>𝕩</span></code> always matches <code><span class='Function'>⌽∨</span><span class='Value'>𝕩</span></code>. And in the table below we can see that the numbers are all reversed but &quot;dog&quot; and &quot;pig&quot; stay in the same order.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=KDHiio/LmHQpIOKNkuKKuOKKjyB0">↗️</a><pre> <span class='Paren'>(</span><span class='Number'>1</span><span class='Function'>⊏</span><span class='Modifier'>˘</span><span class='Value'>t</span><span class='Paren'>)</span> <span class='Function'>⍒</span><span class='Modifier2'>⊸</span><span class='Function'>⊏</span> <span class='Value'>t</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIHQg4oaQIFsgImRvZyLigL80LCAiYW50IuKAvzYsICJwaWdlb24i4oC/MiwgInBpZyLigL80IF0KKDHiio/LmHQpIOKNkuKKuOKKjyB0">↗️</a><pre> <span class='Paren'>(</span><span class='Number'>1</span><span class='Function'>⊏</span><span class='Modifier'>˘</span><span class='Value'>t</span><span class='Paren'>)</span> <span class='Function'>⍒</span><span class='Modifier2'>⊸</span><span class='Function'>⊏</span> <span class='Value'>t</span>
┌─
╵ "ant" 6
"dog" 4