diff options
Diffstat (limited to 'docs/doc/quick.html')
| -rw-r--r-- | docs/doc/quick.html | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/docs/doc/quick.html b/docs/doc/quick.html index 5b7061a9..64eefcd7 100644 --- a/docs/doc/quick.html +++ b/docs/doc/quick.html @@ -242,7 +242,7 @@ <p>Going left to right, <code><span class='Function'>GV</span><span class='Ligature'>โฟ</span><span class='Function'>GS</span></code> indicates <a href="expression.html#destructuring">destructuring assignment</a>, which will expect a list of two values on the right and take it apart to assign the two names. The right hand side is the function <code><span class='Brace'>{</span><span class='Function'>๐</span><span class='Modifier'>ยจ</span><span class='Brace'>}</span><span class='Modifier'>ยจ</span></code> applied to a list.</p> <p><code><span class='Brace'>{</span><span class='Function'>๐</span><span class='Modifier'>ยจ</span><span class='Brace'>}</span></code> is a block function, like <code><span class='Function'>Split</span></code> but a lot shorter. It uses the uppercase <code><span class='Function'>๐</span></code> instead of <code><span class='Value'>๐ฉ</span></code>, so that it treats <code><span class='Value'>๐ฉ</span></code> as a function (it doesn't <em>require</em> it to be a function, though: see <a href="context.html#mixing-roles">mixing roles</a>). It adds an Each <code><span class='Modifier'>ยจ</span></code> onto its argument. This is used to convert the two functions in the list from functions that work on a namespaces to functions that work on a list of them.</p> <p>The list is split across two lines, using newline as a <a href="token.html#separators">separator</a> instead of <code><span class='Separator'>,</span></code> or <code><span class='Separator'>โ</span></code>. Its second function <code><span class='Brace'>{</span><span class='Value'>๐ฉ.spl</span><span class='Brace'>}</span></code> is simpler: it takes a namespace <code><span class='Value'>๐ฉ</span></code> and gets the field named <code><span class='Value'>spl</span></code>.</p> -<p>The first function is more complicated, because the argument namespace might or might not have an <code><span class='Value'>str</span></code> field. The list-like notation <code><span class='Bracket'>โจ</span><span class='Value'>s</span><span class='Gets'>โ</span><span class='Value'>str</span><span class='Bracket'>โฉ</span></code> is another example of destructuring assignment, but this time it destructures a namespace, using an <a href="namespace.html#imports">alias</a> to give it a short name. This header leaves off the function name <code><span class='Function'>๐</span></code>, using a <a href="block.html#case-headers">special rule</a> for one-argument functions. Arguments in headers are very similar to assignment targets, but if the destructuring doesn't match it tries the next body (if there is one) instead of giving an error. So if the argument is a namespace with an <code><span class='Value'>str</span></code> field then <code><span class='Brace'>{</span><span class='Bracket'>โจ</span><span class='Value'>s</span><span class='Gets'>โ</span><span class='Value'>str</span><span class='Bracket'>โฉ</span><span class='Head'>:</span><span class='Value'>s</span><span class='Head'>;</span><span class='String'>""</span><span class='Brace'>}</span></code> returns that field's value, and otherwise it returns <code><span class='String'>""</span></code>.</p> +<p>The first function is more complicated, because the argument namespace might or might not have an <code><span class='Value'>str</span></code> field. The list-like notation <code><span class='Bracket'>โจ</span><span class='Value'>s</span><span class='Gets'>โ</span><span class='Value'>str</span><span class='Bracket'>โฉ</span></code> is another example of destructuring assignment, but this time it destructures a namespace, using an <a href="namespace.html#imports">alias</a> to give it a short name. This header leaves off the function name <code><span class='Function'>๐</span></code>, using a <a href="block.html#special-names-in-headers">special rule</a> for one-argument functions. Arguments in headers are very similar to assignment targets, but if the destructuring doesn't match it tries the next body (if there is one) instead of giving an error. So if the argument is a namespace with an <code><span class='Value'>str</span></code> field then <code><span class='Brace'>{</span><span class='Bracket'>โจ</span><span class='Value'>s</span><span class='Gets'>โ</span><span class='Value'>str</span><span class='Bracket'>โฉ</span><span class='Head'>:</span><span class='Value'>s</span><span class='Head'>;</span><span class='String'>""</span><span class='Brace'>}</span></code> returns that field's value, and otherwise it returns <code><span class='String'>""</span></code>.</p> <h3 id="assembly"><a class="header" href="#assembly">Assembly</a></h3> <p>Now that <code><span class='Function'>Split</span></code> has defined <code><span class='Function'>Proc</span></code>, <code><span class='Function'>GV</span></code> (get value), and <code><span class='Function'>GS</span></code> (get split), it's ready to do its work.</p> <pre><span class='Value'>r</span> <span class='Gets'>โ</span> <span class='Function'>Proc</span><span class='Brace'>{</span><span class='Function'>ยป๐ฝ</span><span class='Modifier'>ยจ</span><span class='Function'>โข</span><span class='Brace'>}</span> <span class='Value'>๐ฉ</span> |
