diff options
Diffstat (limited to 'docs/tutorial/expression.html')
| -rw-r--r-- | docs/tutorial/expression.html | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/tutorial/expression.html b/docs/tutorial/expression.html index a3e8e3f0..6098e7a4 100644 --- a/docs/tutorial/expression.html +++ b/docs/tutorial/expression.html @@ -127,9 +127,9 @@ <p>Addition and subtraction with affine characters have all the same algebraic properties that they do with numbers. One way to see this is to think of values as a combination of "characterness" (0 for numbers and 1 for characters) and either numeric value or code point. Addition and subtraction are done element-wise on these pairs of numbers, and are allowed if the result is a valid value, that is, its characterness is 0 or 1 and its value is a valid code point if the characterness is 1. However, because the space of values is no longer closed under addition and subtraction, certain rearrangements of valid computations might not be valid, if one of the values produced in the middle isn't legal.</p> <h2 id="modifiers">Modifiers</h2> <p>Functions are nice and all, but to really bring us into the space age BQN has a second level of function called <em>modifiers</em> (the space age in this case is when operators were introduced to APL in the early 60s—hey, did you know the <a href="https://aplwiki.com/wiki/APL_conference#1970">second APL conference</a> was held at Goddard Space Flight Center?). While functions apply to subjects, modifiers can apply to functions <em>or</em> subjects, and return functions. For example, the 1-modifier <code><span class='Modifier'>˜</span></code> modifies one function by swapping the arguments before calling it (Swap), or copying the right argument to the left if there's only one (Self).</p> -<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MiAty5wgJ2QnICAjIFN1YnRyYWN0IGZyb20KK8ucIDMgICMgQWRkIHRvIGl0c2VsZg==&run">↗️</a><pre> <span class='Number'>2</span> <span class='Function'>-</span><span class='Modifier'>˜</span> <span class='String'>'d'</span> <span class='Comment'># Subtract from +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MiAty5wgJ2QnICAjIFN1YnRyYWN0IGZyb20KK8ucIDMgICAgICAjIEFkZCB0byBpdHNlbGY=&run">↗️</a><pre> <span class='Number'>2</span> <span class='Function'>-</span><span class='Modifier'>˜</span> <span class='String'>'d'</span> <span class='Comment'># Subtract from </span>'b' - <span class='Function'>+</span><span class='Modifier'>˜</span> <span class='Number'>3</span> <span class='Comment'># Add to itself + <span class='Function'>+</span><span class='Modifier'>˜</span> <span class='Number'>3</span> <span class='Comment'># Add to itself </span>6 </pre> <p>This gives us two nice ways to square a value:</p> |
