diff options
Diffstat (limited to 'docs/doc')
| -rw-r--r-- | docs/doc/undo.html | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/doc/undo.html b/docs/doc/undo.html index 5afa4543..64d8ab53 100644 --- a/docs/doc/undo.html +++ b/docs/doc/undo.html @@ -27,7 +27,7 @@ <span class='Function'>×</span><span class='Modifier'>˜⁼</span> <span class='Function'>×</span><span class='Modifier'>˜</span> <span class='Number'>¯3</span> <span class='Comment'># It's not the same! </span>3 </pre> -<p>Don't worry, this isn't 'nam. Undo doesn't always satisfy <code><span class='Value'>𝕩</span> <span class='Function'>≡</span> <span class='Function'>𝔽</span><span class='Modifier'>⁼</span> <span class='Function'>𝔽</span> <span class='Value'>𝕩</span></code>, but it <em>does</em> obey <code><span class='Value'>𝕩</span> <span class='Function'>≡</span> <span class='Function'>𝔽</span> <span class='Function'>𝔽</span><span class='Modifier'>⁼</span> <span class='Value'>𝕩</span></code>. That is, it gives one possible argument that could have been passed to <code><span class='Function'>𝔽</span></code>, just not necessarily the one that actually was. BQN is conservative in how it uses this freedom, so that it won't for example make up new elements entirely to find an inverse. It's usually used when there's an obvious or standard way to pick which of the possible values should be returned.</p> +<p>Don't worry, this isn't 'nam. Undo doesn't always satisfy <code><span class='Value'>𝕩</span> <span class='Function'>≡</span> <span class='Function'>𝔽</span><span class='Modifier'>⁼</span> <span class='Function'>𝔽</span> <span class='Value'>𝕩</span></code>, but it <em>does</em> obey <code><span class='Value'>𝕩</span> <span class='Function'>≡</span> <span class='Function'>𝔽</span> <span class='Function'>𝔽</span><span class='Modifier'>⁼</span> <span class='Value'>𝕩</span></code>. That is, it gives one possible argument that could have been passed to <code><span class='Function'>𝔽</span></code>, just not necessarily the one that actually was. BQN is conservative in how it uses this freedom, so that it won't for example make up new elements entirely to find an inverse: <code><span class='Number'>1</span><span class='Modifier2'>⊸</span><span class='Function'>↓</span></code> is one function that it could undo but won't. It's usually used when there's an obvious or standard way to pick which of the possible values should be returned.</p> <p>In a BQN with floating-point numbers, computations are approximate, so the inverse is allowed to be approximate as well (any error should still be very small though).</p> <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 @@ -35,7 +35,7 @@ <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> +<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 array.</p> <p>Structural functions like <a href="take.html">Take</a> and <a href="shift.html">shifts</a> that remove elements from <code><span class='Value'>𝕩</span></code> can't be inverted, because given the result there's no way to know what the elements should be. However, there are two special cases that have inverses defined despite losing data: these are <code><span class='Function'>⊣</span><span class='Modifier'>⁼</span></code> and <code><span class='Value'>k</span><span class='Modifier'>⁼</span></code> where <code><span class='Value'>k</span></code> is a constant (a data type, or <code><span class='Value'>k</span><span class='Modifier'>˙</span></code>). For these, <code><span class='Value'>𝕩</span></code> is required to <a href="match.html">match</a> the always returned value <code><span class='Value'>𝕨</span></code> or <code><span class='Value'>k</span></code>, and this value is also used for the result—even though any result would be valid, as these functions ignore <code><span class='Value'>𝕩</span></code>.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MyDiiqPigbwgNAozIOKKo+KBvCAz">↗️</a><pre> <span class='Number'>3</span> <span class='Function'>⊣</span><span class='Modifier'>⁼</span> <span class='Number'>4</span> ERROR |
