aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-07-07 12:38:38 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-07-07 12:38:38 -0400
commit8d9506d2fe2063d9b5d4604e5d3d7c2b2ce3df56 (patch)
tree9b3940ed311d9a71d67ccef0155f54b2b185ed31
parent4d602ea36183e62e463cea08900a16ea6240a03f (diff)
Mention ¯1⊑ as the obvious way to get the last element
-rw-r--r--doc/pick.md3
-rw-r--r--docs/doc/pick.html6
2 files changed, 6 insertions, 3 deletions
diff --git a/doc/pick.md b/doc/pick.md
index 12a7003c..425b8cf9 100644
--- a/doc/pick.md
+++ b/doc/pick.md
@@ -52,9 +52,10 @@ If `𝕩` is empty then Pick always results in an error. First never gives an er
So one way to find the fill element for an array `𝕩` of any shape is `⊑0⥊𝕩`.
-In APL it's common to get the last element of a list with an idiom that translates to `⊑⌽`, or First-[Reverse](reverse.md). I prefer to use [Fold](fold.md) with the Right [identity function](identity.md).
+In APL it's common to get the last element of a list with an idiom that translates to `⊑⌽`, or First-[Reverse](reverse.md). In BQN the most straightforward way is to select with index `¯1` instead. I also sometimes use [Fold](fold.md) with the Right [identity function](identity.md).
⊑⌽ "last"
+ ¯1⊑ "last"
⊢´ "last"
## Many elements
diff --git a/docs/doc/pick.html b/docs/doc/pick.html
index 3f5495aa..0926b3a0 100644
--- a/docs/doc/pick.html
+++ b/docs/doc/pick.html
@@ -64,8 +64,10 @@
⟨ " " ⟨ 0 0 0 0 ⟩ ⟩
</pre>
<p>So one way to find the fill element for an array <code><span class='Value'>𝕩</span></code> of any shape is <code><span class='Function'>⊑</span><span class='Number'>0</span><span class='Function'>⥊</span><span class='Value'>𝕩</span></code>.</p>
-<p>In APL it's common to get the last element of a list with an idiom that translates to <code><span class='Function'>⊑⌽</span></code>, or First-<a href="reverse.html">Reverse</a>. I prefer to use <a href="fold.html">Fold</a> with the Right <a href="identity.html">identity function</a>.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqR4oy9ICJsYXN0IgriiqLCtCAibGFzdCI=">↗️</a><pre> <span class='Function'>⊑⌽</span> <span class='String'>&quot;last&quot;</span>
+<p>In APL it's common to get the last element of a list with an idiom that translates to <code><span class='Function'>⊑⌽</span></code>, or First-<a href="reverse.html">Reverse</a>. In BQN the most straightforward way is to select with index <code><span class='Number'>¯1</span></code> instead. I also sometimes use <a href="fold.html">Fold</a> with the Right <a href="identity.html">identity function</a>.</p>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqR4oy9ICJsYXN0IgrCrzHiipEgImxhc3QiCuKKosK0ICJsYXN0Ig==">↗️</a><pre> <span class='Function'>⊑⌽</span> <span class='String'>&quot;last&quot;</span>
+'t'
+ <span class='Number'>¯1</span><span class='Function'>⊑</span> <span class='String'>&quot;last&quot;</span>
't'
<span class='Function'>⊢</span><span class='Modifier'>´</span> <span class='String'>&quot;last&quot;</span>
't'