diff options
Diffstat (limited to 'docs/doc')
| -rw-r--r-- | docs/doc/block.html | 2 | ||||
| -rw-r--r-- | docs/doc/functional.html | 4 | ||||
| -rw-r--r-- | docs/doc/syntax.html | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/docs/doc/block.html b/docs/doc/block.html index 21354448..10896e93 100644 --- a/docs/doc/block.html +++ b/docs/doc/block.html @@ -94,7 +94,7 @@ </pre> <p>However, <code><span class='Nothing'>Β·</span></code> can only be used as an argument, and not a list element or operand. Don't use <code><span class='Value'>π¨</span></code> in these ways in a function that could be called monadically. Another potential issue is that <code><span class='Modifier2'>βΈ</span></code> and <code><span class='Modifier2'>β</span></code> don't work the way you might expect.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=eyDwnZWoIOKLhuKKuC0g8J2VqSB9IDU=">βοΈ</a><pre> <span class='Brace'>{</span> <span class='Value'>π¨</span> <span class='Function'>β</span><span class='Modifier2'>βΈ</span><span class='Function'>-</span> <span class='Value'>π©</span> <span class='Brace'>}</span> <span class='Number'>5</span> -143.413159102577 +143.4131591025766 </pre> <p>Called dyadically, this function will expand to <code><span class='Paren'>(</span><span class='Function'>β</span><span class='Value'>π¨</span><span class='Paren'>)</span><span class='Function'>-</span><span class='Value'>π©</span></code>, so we might expect the monadic result to be <code><span class='Function'>-</span><span class='Value'>π©</span></code>. This sort of expansion isn't right with <code><span class='Nothing'>Β·</span></code> on the left. <code><span class='Function'>β</span><span class='Modifier2'>βΈ</span><span class='Function'>-</span></code> taken as a whole is a function, so <code><span class='Nothing'>Β·</span> <span class='Function'>β</span><span class='Modifier2'>βΈ</span><span class='Function'>-</span> <span class='Value'>π©</span></code> is just <code><span class='Function'>β</span><span class='Modifier2'>βΈ</span><span class='Function'>-</span> <span class='Value'>π©</span></code>, or <code><span class='Paren'>(</span><span class='Function'>β</span><span class='Value'>π©</span><span class='Paren'>)</span><span class='Function'>-</span><span class='Value'>π©</span></code>, giving the large result seen above.</p> <h3 id="operands">Operands</h3> diff --git a/docs/doc/functional.html b/docs/doc/functional.html index 7debbe20..76dc6777 100644 --- a/docs/doc/functional.html +++ b/docs/doc/functional.html @@ -111,11 +111,11 @@ <p>Like any function, this one can be given a name and then called. A quirk of this way of defining a function is that it has a subject role (it's the result of the function <code><span class='Brace'>{</span><span class='Function'>π</span><span class='Modifier2'>β</span><span class='Function'>π</span><span class='Brace'>}</span><span class='Modifier'>Β΄</span></code>) and so must be defined with a lowercase name.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Z2F1c3Mg4oaQIHvwnZWO4oiY8J2Vj33CtCDii4bigL8t4oC/KMOXy5wpCkdhdXNzIDI=">βοΈ</a><pre> <span class='Value'>gauss</span> <span class='Gets'>β</span> <span class='Brace'>{</span><span class='Function'>π</span><span class='Modifier2'>β</span><span class='Function'>π</span><span class='Brace'>}</span><span class='Modifier'>Β΄</span> <span class='Function'>β</span><span class='Ligature'>βΏ</span><span class='Function'>-</span><span class='Ligature'>βΏ</span><span class='Paren'>(</span><span class='Function'>Γ</span><span class='Modifier'>Λ</span><span class='Paren'>)</span> <span class='Function'>Gauss</span> <span class='Number'>2</span> -0.0183156388887342 +0.01831563888873418 </pre> <p>Another, and probably more common, use of arrays of functions is to apply several different functions to one or more arguments. Here we apply three different functions to the number 9:</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4p+o4oiaLCAy4oq44oi+LCDiiqIt4ouG4p+pIHvwnZWO8J2VqX3CqCA5">βοΈ</a><pre> <span class='Bracket'>β¨</span><span class='Function'>β</span><span class='Separator'>,</span> <span class='Number'>2</span><span class='Modifier2'>βΈ</span><span class='Function'>βΎ</span><span class='Separator'>,</span> <span class='Function'>β’-β</span><span class='Bracket'>β©</span> <span class='Brace'>{</span><span class='Function'>π</span><span class='Value'>π©</span><span class='Brace'>}</span><span class='Modifier'>Β¨</span> <span class='Number'>9</span> -β¨ 3 β¨ 2 9 β© Β―8094.08392757538 β© +β¨ 3 β¨ 2 9 β© Β―8094.083927575384 β© </pre> <p>The 2-modifier Choose (<code><span class='Modifier2'>βΆ</span></code>) relies on arrays of functions toβ¦ function. It's very closely related to Pick <code><span class='Function'>β</span></code>, and in fact when the left operand and the elements of the right operand are all data there's no real difference: Choose returns the constant function <code><span class='Value'>π</span><span class='Function'>β</span><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=MuKXtiJhYmNkZWYiICJhcmci">βοΈ</a><pre> <span class='Number'>2</span><span class='Modifier2'>βΆ</span><span class='String'>"abcdef"</span> <span class='String'>"arg"</span> diff --git a/docs/doc/syntax.html b/docs/doc/syntax.html index 4f8eb345..88e006fc 100644 --- a/docs/doc/syntax.html +++ b/docs/doc/syntax.html @@ -108,7 +108,7 @@ <p>BQN has single-token notation for numbers, strings, and characters.</p> <p>Numbers allow the typical decimal notation with <code><span class='Number'>Β―</span></code> for the negative sign (because <code><span class='Function'>-</span></code> is a function) and <code><span class='Value'>e</span></code> for scientific notation (or <code><span class='Function'>E</span></code>, as numeric notation is case-insensitive). <code><span class='Number'>β</span></code> and <code><span class='Number'>Ο</span></code> may be used as special numeric values. If complex numbers are supported, then they can be written with the components separated by <code><span class='Value'>i</span></code>. However, no BQN to date supports complex numbers.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4p+oIMKvz4Ag4ouEIDAuNSDii4QgNWXCrzEg4ouEIDEuNUUzIOKLhCDiiJ4g4p+pICAgIyBBIGxpc3Qgb2YgbnVtYmVycw==">βοΈ</a><pre> <span class='Bracket'>β¨</span> <span class='Number'>Β―Ο</span> <span class='Separator'>β</span> <span class='Number'>0.5</span> <span class='Separator'>β</span> <span class='Number'>5eΒ―1</span> <span class='Separator'>β</span> <span class='Number'>1.5E3</span> <span class='Separator'>β</span> <span class='Number'>β</span> <span class='Bracket'>β©</span> <span class='Comment'># A list of numbers -</span>β¨ Β―3.14159265358979 0.5 0.5 1500 β β© +</span>β¨ Β―3.141592653589793 0.5 0.5 1500 β β© </pre> <p>Strings are written with double quotes <code><span class='String'>""</span></code>, and characters with single quotes <code><span class='String'>''</span></code> with a single character in between. A double quote within a string can be escaped by writing it twice; if two string literals are next to each other, they must be separated by a space. In contrast, character literals do not use escapes, as the length is already known.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4omgwqgg4p+oICJzdHIiIOKLhCAicyd0IiJyIiDii4QgJ2MnIOKLhCAnJycg4ouEICciJyDin6kgICAjICIiIGlzIGFuIGVzY2FwZQoK4omhwqgg4p+oICJhIiDii4QgJ2EnIOKfqSAgICMgQSBzdHJpbmcgaXMgYW4gYXJyYXkgYnV0IGEgY2hhcmFjdGVyIGlzbid0">βοΈ</a><pre> <span class='Function'>β </span><span class='Modifier'>Β¨</span> <span class='Bracket'>β¨</span> <span class='String'>"str"</span> <span class='Separator'>β</span> <span class='String'>"s't""r"</span> <span class='Separator'>β</span> <span class='String'>'c'</span> <span class='Separator'>β</span> <span class='String'>'''</span> <span class='Separator'>β</span> <span class='String'>'"'</span> <span class='Bracket'>β©</span> <span class='Comment'># "" is an escape |
