diff options
Diffstat (limited to 'docs/doc/undo.html')
| -rw-r--r-- | docs/doc/undo.html | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/doc/undo.html b/docs/doc/undo.html index dc3f9d37..5e7d6276 100644 --- a/docs/doc/undo.html +++ b/docs/doc/undo.html @@ -4,7 +4,7 @@ <title>BQN: Undo</title> </head> <div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div> -<h1 id="undo">Undo</h1> +<h1 id="undo"><a class="header" href="#undo">Undo</a></h1> <p>Oh no, you've deleted a function after spending half an hour writing it! Well… hopefully your editor can help with that. But maybe you'll be interested to hear that BQN can reverse the action of some functions—ones that <em>don't</em> lose information. This capability is also used by <a href="repeat.html">Repeat</a> (<code><span class='Modifier2'>⍟</span></code>) to repeat a negative number of times.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MiDijL0gImFiY2RlIgoKMiDijL3igbwgMiDijL0gImFiY2RlIg==">↗️</a><pre> <span class='Number'>2</span> <span class='Function'>⌽</span> <span class='String'>"abcde"</span> "cdeab" @@ -20,7 +20,7 @@ "BQN" </pre> <p>Here it undoes a function to decrement the last character by incrementing that character. In part this is enabled by the clean design of BQN primitives, because better-behaved functions like those using structural Under are easier to invert.</p> -<h2 id="the-rules">The rules</h2> +<h2 id="the-rules"><a class="header" href="#the-rules">The rules</a></h2> <p>If <code><span class='Function'>𝔽</span></code> can be inverted exactly, then Undo just does that. However, there are also some other functions that BQN inverts. For example, the squaring function <code><span class='Function'>×</span><span class='Modifier'>˜</span></code> has both a positive and a negative inverse, and yet:</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=w5fLnCDCrzMKw5fLnOKBvCDDl8ucIMKvMyAgIyBJdCdzIG5vdCB0aGUgc2FtZSE=">↗️</a><pre> <span class='Function'>×</span><span class='Modifier'>˜</span> <span class='Number'>¯3</span> 9 @@ -32,7 +32,7 @@ <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=NiAtIOKImuKBvOKImjY=">↗️</a><pre> <span class='Number'>6</span> <span class='Function'>-</span> <span class='Function'>√</span><span class='Modifier'>⁼</span><span class='Function'>√</span><span class='Number'>6</span> 8.881784197001252e¯16 </pre> -<h2 id="whats-supported">What's supported?</h2> +<h2 id="whats-supported"><a class="header" href="#whats-supported">What's supported?</a></h2> <p>For the full list, see <a href="../spec/inferred.html#undo">the specification</a>. An individual implementation might support a lot more functionality than is required, so if you're not concerned about portability just try out whatever function you're interested in.</p> <p>Arithmetic and simple combinators are usually invertible. A compound function that refers to its argument just once, like <code><span class='Number'>6</span><span class='Function'>+⌽</span><span class='Modifier2'>∘</span><span class='Function'>⍉</span></code>, can typically be undone, but one that uses the argument in two different ways, such as <code><span class='Function'>⊢+⋆</span></code>, probably can't.</p> <p>A few notable inverses are the <a href="arithmetic.html#basic-arithmetic">logarithm</a> <code><span class='Function'>⋆</span><span class='Modifier'>⁼</span></code>, <a href="transpose.html">un-Transpose</a> <code><span class='Function'>⍉</span><span class='Modifier'>⁼</span></code>, and <a href="replicate.html#inverse">Indices inverse</a> <code><span class='Function'>/</span><span class='Modifier'>⁼</span></code>. <a href="enclose.html">Enclose</a> inverse, <code><span class='Function'><</span><span class='Modifier'>⁼</span></code>, is an alternative to <a href="pick.html#first">First</a> that requires its argument to be a unit.</p> @@ -42,7 +42,7 @@ ERROR <span class='Number'>3</span> <span class='Function'>⊣</span><span class='Modifier'>⁼</span> <span class='Number'>3</span> 3 </pre> -<h2 id="undo-headers">Undo headers</h2> +<h2 id="undo-headers"><a class="header" href="#undo-headers">Undo headers</a></h2> <p>Undo headers are currently supported only by dzaima/BQN.</p> <p>Of course BQN will never be able to invert all the functions you could write (if it could you could earn a <em>lot</em> of bitcoins, among other feats). But it does recognize some <a href="block.html#block-headers">header</a> forms that you can use to specify the inverse of a block function. BQN will trust you and won't verify the results your specified inverse gives.</p> <pre><span class='Brace'>{</span> |
