Skip to content

Commit e28a0ae

Browse files
committed
First update December
1 parent 910ee7d commit e28a0ae

File tree

12 files changed

+29
-30
lines changed

12 files changed

+29
-30
lines changed

js/search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3691,7 +3691,7 @@ $(function(){
36913691
,
36923692
{ category: "Reference", value: "package (declarator)", url: "/language/syntax#index-entry-declarator_unit-declarator_module-declarator_package-Package,_Module,_Class,_Role,_and_Grammar_declaration" }
36933693
,
3694-
{ category: "Reference", value: "PERL6LIB", url: "/language/5to6-nutshell#index-entry-PERL6LIB-PERL6LIB" }
3694+
{ category: "Reference", value: "RAKULIB", url: "/language/5to6-nutshell#index-entry-RAKULIB-RAKULIB" }
36953695
,
36963696
{ category: "Reference", value: "Regular Expressions", url: "/language/regexes#index-entry-Regular_Expressions" }
36973697
,

language/101-basics.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ <h2 id="Blocks"><a class="u" href="#___top" title="go to top of document">Blocks
148148
<p>You have seen blocks before: both the <code>for</code> loop <code>-&gt; $line { ... } </code> and the <code>if</code> statement worked on blocks. A block is a self-contained piece of Raku code with an optional signature (the <code>-&gt; $line </code> part).</p>
149149
<p>The simplest way to sort the players by score would be <code>@names.sort({ %matches{$_} })</code>, which sorts by number of matches won. However Ana and Dave have both won two matches. That simple sort doesn&#39;t account for the number of sets won, which is the secondary criterion to decide who has won the tournament.</p>
150150
<h2 id="Stable_sort"><a class="u" href="#___top" title="go to top of document">Stable sort</a></h2>
151-
<p>When two array items have the same value, <code>sort</code> leaves them in the same order as it found them. Computer scientists call this a <em>stable sort</em>. The program takes advantage of this property of Raku&#39;s <code>sort</code> to achieve the goal by sorting twice: first by the number of sets won (the primary criterion), then by the number of matches won (the secondary criterion).</p>
151+
<p>When two array items have the same value, <code>sort</code> leaves them in the same order as it found them. Computer scientists call this a <em>stable sort</em>. The program takes advantage of this property of Raku&#39;s <code>sort</code> to achieve the goal by sorting twice: first by the number of sets won (the secondary criterion), then by the number of matches won (the primary criterion).</p>
152152
<p>After the first sorting step, the names are in the order <code>Beth Charlie Dave Ana</code>. After the second sorting step, it&#39;s still the same, because no one has won fewer matches but more sets than someone else. Such a situation is entirely possible, especially at larger tournaments.</p>
153153
<p><code>sort</code> sorts in ascending order, from smallest to largest. This is the opposite of the desired order. Therefore, the code calls the <code>.reverse</code> method on the result of the second sort, and stores the final list in <code>@sorted</code>.</p>
154154
<h1 id="Standard_output"><a class="u" href="#___top" title="go to top of document">Standard output</a></h1>

language/5to6-nutshell.html

Lines changed: 9 additions & 10 deletions
Large diffs are not rendered by default.

language/5to6-perlfunc.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ <h1 class="title">Perl to Raku guide - functions</h1>
205205
<tr class="toc-level-2"><td class="toc-number">3.134</td><td class="toc-text"><a href="#sort">sort</a></td></tr>
206206
<tr class="toc-level-2"><td class="toc-number">3.135</td><td class="toc-text"><a href="#splice">splice</a></td></tr>
207207
<tr class="toc-level-2"><td class="toc-number">3.136</td><td class="toc-text"><a href="#split">split</a></td></tr>
208-
<tr class="toc-level-2"><td class="toc-number">3.137</td><td class="toc-text"><a href="#sprintf">sprintf</a></td></tr>
208+
<tr class="toc-level-2"><td class="toc-number">3.137</td><td class="toc-text"><a href="#sprintf">sprintf</a></td></tr>
209209
<tr class="toc-level-2"><td class="toc-number">3.138</td><td class="toc-text"><a href="#sqrt">sqrt</a></td></tr>
210210
<tr class="toc-level-2"><td class="toc-number">3.139</td><td class="toc-text"><a href="#srand">srand</a></td></tr>
211211
<tr class="toc-level-2"><td class="toc-number">3.140</td><td class="toc-text"><a href="#stat">stat</a></td></tr>
@@ -1404,7 +1404,7 @@ <h2 id="split"><a class="u" href="#___top" title="go to top of document">split</
14041404
<ul><li><p>split</p>
14051405
</li>
14061406
</ul>
1407-
<p>The zero argument version must now be called with an explicit empty string, as described above.</p>
1407+
<p><code>split</code> now requires a pattern. For the equivalent of Perl&#39;s behaviour of splitting on whitespace when no pattern is specified, use <a href="/routine/words">words</a> (or use <code>split</code> with <code>/\s+/</code> as the pattern and <code>:skip-empty</code> as a named argument).</p>
14081408
<p><a name="index-entry-sprintf_-_perlfunc"></a></p>
14091409
<h2 id="sprintf"><a class="u" href="#___top" title="go to top of document">sprintf</a></h2>
14101410
<ul><li><p>sprintf FORMAT, LIST</p>

language/objects.html

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

language/temporal.html

Lines changed: 5 additions & 5 deletions
Large diffs are not rendered by default.

language/variables.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ <h3 id="Rakudo-specific_compile-time_variables"><a class="u" href="#___top" titl
417417
<p>Thus, the following recursive definition does <strong>not</strong> work:</p>
418418
<pre class="editor editor-colors"><div class="line"><span class="source raku"><span class="storage type declarator type raku"><span>multi</span></span><span>&nbsp;</span><span class="entity name function raku"><span>broken-fibonacci</span></span><span>(</span><span class="meta variable container raku"><span class="variable other identifier sigil raku"><span>$</span></span><span class="variable other identifier raku"><span>n</span></span></span><span>&nbsp;</span><span class="storage modifier type constraints raku"><span>where</span></span><span>&nbsp;</span><span class="keyword operator generic raku"><span>*</span></span><span>&nbsp;≤&nbsp;</span><span class="constant numeric raku"><span>1</span></span><span>)&nbsp;</span><span class="meta block raku"><span class="punctuation definition block raku"><span>{</span></span><span>&nbsp;</span><span class="meta variable container raku"><span class="variable other identifier sigil raku"><span>$</span></span><span class="variable other identifier raku"><span>n</span></span></span><span>&nbsp;</span><span class="punctuation definition block raku"><span>}</span></span></span></span></div><div class="line"><span class="source raku"><span class="storage type declarator type raku"><span>multi</span></span><span>&nbsp;</span><span class="entity name function raku"><span>broken-fibonacci</span></span><span>(</span><span class="meta variable container raku"><span class="variable other identifier sigil raku"><span>$</span></span><span class="variable other identifier raku"><span>n</span></span></span><span>&nbsp;</span><span class="storage modifier type constraints raku"><span>where</span></span><span>&nbsp;</span><span class="keyword operator generic raku"><span>*</span></span><span>&nbsp;</span><span class="keyword operator generic raku"><span>&gt;</span></span><span>&nbsp;</span><span class="constant numeric raku"><span>0</span></span><span>)&nbsp;</span><span class="meta block raku"><span class="punctuation definition block raku"><span>{</span></span></span></span></div><div class="line"><span class="source raku"><span class="meta block raku"><span>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="meta variable container raku"><span class="variable other identifier sigil raku"><span>&amp;</span></span><span class="support class twigil raku"><span>?</span></span><span class="variable other identifier raku"><span>ROUTINE</span></span></span><span>(</span><span class="meta variable container raku"><span class="variable other identifier sigil raku"><span>$</span></span><span class="variable other identifier raku"><span>n</span></span></span><span>&nbsp;</span><span class="keyword operator generic raku"><span>-</span></span><span>&nbsp;</span><span class="constant numeric raku"><span>1</span></span><span>)&nbsp;</span><span class="keyword operator generic raku"><span>+</span></span><span>&nbsp;</span><span class="meta variable container raku"><span class="variable other identifier sigil raku"><span>&amp;</span></span><span class="support class twigil raku"><span>?</span></span><span class="variable other identifier raku"><span>ROUTINE</span></span></span><span>(</span><span class="meta variable container raku"><span class="variable other identifier sigil raku"><span>$</span></span><span class="variable other identifier raku"><span>n</span></span></span><span>&nbsp;</span><span class="keyword operator generic raku"><span>-</span></span><span>&nbsp;</span><span class="constant numeric raku"><span>2</span></span><span>)</span></span></span></div><div class="line"><span class="source raku"><span class="meta block raku"><span class="punctuation definition block raku"><span>}</span></span></span></span></div></pre><p>If called, <code>&amp;?ROUTINE</code> would always refer to the second multi candidate and would never dispatch to the first. If you want to use self-recursion for the whole <code>proto</code>, either use the function name or <a href="language/functions#sub_samewith"><code>samewith</code></a>.</p>
419419
<h3 id="&?BLOCK"><a class="u" href="#___top" title="go to top of document"><a name="index-entry-&?BLOCK"><span class="index-entry">&amp;?BLOCK</span></a></a></h3>
420-
<p>The special compile variable <code>?&amp;BLOCK</code> behaves similarly to <code>?&amp;ROUTINE</code> but it allows to introspect a single block of code. It holds a <a href="/type/Sub">Sub</a> and allows for recursion within the same block:</p>
420+
<p>The special compile variable <code>&amp;?BLOCK</code> behaves similarly to <code>&amp;?ROUTINE</code> but it allows to introspect a single block of code. It holds a <a href="/type/Sub">Sub</a> and allows for recursion within the same block:</p>
421421
<pre class="editor editor-colors"><div class="line"><span class="source raku"><span class="keyword control repeat raku"><span>for</span></span><span>&nbsp;</span><span class="string quoted single single raku"><span class="punctuation definition string begin raku"><span>&#39;</span></span><span>.</span><span class="punctuation definition string end raku"><span>&#39;</span></span></span><span>&nbsp;</span><span class="meta block raku"><span class="punctuation definition block raku"><span>{</span></span></span></span></div><div class="line"><span class="source raku"><span class="meta block raku"><span>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword operator generic raku"><span>.</span></span><span class="support type raku"><span>Str</span></span><span class="keyword operator generic raku"><span>.</span></span><span class="support function raku"><span>say</span></span><span>&nbsp;</span><span class="keyword control flowcontrol raku"><span>when</span></span><span>&nbsp;</span><span class="keyword operator generic raku"><span>!</span><span>.</span></span><span class="support type raku"><span>IO</span></span><span class="keyword operator generic raku"><span>.</span></span><span class="support function raku"><span>d</span></span><span>;</span></span></span></div><div class="line"><span class="source raku"><span class="meta block raku"><span>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword operator generic raku"><span>.</span></span><span class="support type raku"><span>IO</span></span><span class="keyword operator generic raku"><span>.</span></span><span class="support function raku"><span>dir</span></span><span>()»</span><span class="keyword operator generic raku"><span>.</span></span><span class="meta variable container raku"><span class="variable other identifier sigil raku"><span>&amp;</span></span><span class="support class twigil raku"><span>?</span></span><span class="variable other identifier raku"><span>BLOCK</span></span></span><span>&nbsp;</span><span class="keyword control flowcontrol raku"><span>when</span></span><span>&nbsp;</span><span class="keyword operator generic raku"><span>.</span></span><span class="support type raku"><span>IO</span></span><span class="keyword operator generic raku"><span>.</span></span><span class="support function raku"><span>d</span></span><span>&nbsp;</span><span class="comment line number-sign raku"><span class="punctuation definition comment raku"><span>#</span></span><span>&nbsp;lets&nbsp;recurse&nbsp;a&nbsp;little!</span><span>&nbsp;</span></span></span></span></div><div class="line"><span class="source raku"><span class="meta block raku"><span class="punctuation definition block raku"><span>}</span></span></span></span></div></pre><h3 id="$?DISTRIBUTION"><a class="u" href="#___top" title="go to top of document"><a name="index-entry-$?DISTRIBUTION"><span class="index-entry">$?DISTRIBUTION</span></a></a></h3>
422422
<p><code>$?DISTRIBUTION</code> provides access to the <a href="/type/Distribution">Distribution</a> of the current compilation unit. This gives module authors a way to reference other files in the distribution by their original relative path names, or to view the metadata (via the <code>.meta</code> method), without needing to know the underlying file structure (such as how <code>CompUnit::Repository::Installation</code> changes the file layout on installation).</p>
423423
<pre class="editor editor-colors"><div class="line"><span class="source raku"><span class="routine name raku"><span>unit</span></span><span>&nbsp;</span><span class="meta class raku"><span class="storage type class raku"><span>module</span></span><span>&nbsp;</span><span class="entity name type class raku"><span>MyFoo</span></span></span><span>;</span></span></div><div class="line"><span class="source raku"><span>&nbsp;</span></span></div><div class="line"><span class="source raku"><span class="storage type declarator type raku"><span>sub</span></span><span>&nbsp;</span><span class="entity name function raku"><span>module-version</span></span><span>&nbsp;</span><span class="meta block raku"><span class="punctuation definition block raku"><span>{</span></span></span></span></div><div class="line"><span class="source raku"><span class="meta block raku"><span>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="support function raku"><span>say</span></span><span>&nbsp;</span><span class="string quoted double raku"><span class="punctuation definition string begin raku"><span>&quot;</span></span><span>MyFoo&nbsp;is&nbsp;version:</span><span class="punctuation definition string end raku"><span>&quot;</span></span></span><span>;</span></span></span></div><div class="line"><span class="source raku"><span class="meta block raku"><span>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="support function raku"><span>say</span></span><span>&nbsp;</span><span class="meta variable container raku"><span class="variable other identifier sigil raku"><span>$</span></span><span class="support class twigil raku"><span>?</span></span><span class="variable other identifier raku"><span>DISTRIBUTION</span></span></span><span class="keyword operator generic raku"><span>.</span></span><span class="routine name raku"><span>meta</span></span><span class="span keyword operator array words raku"><span>&lt;</span></span><span class="string array words raku"><span>ver</span></span><span class="span keyword operator array words raku"><span>&gt;</span></span><span>;</span></span></span></div><div class="line"><span class="source raku"><span class="meta block raku"><span class="punctuation definition block raku"><span>}</span></span></span></span></div><div class="line"><span class="source raku"><span>&nbsp;</span></span></div><div class="line"><span class="source raku"><span class="storage type declarator type raku"><span>sub</span></span><span>&nbsp;</span><span class="entity name function raku"><span>module-source</span></span><span>&nbsp;</span><span class="meta block raku"><span class="punctuation definition block raku"><span>{</span></span></span></span></div><div class="line"><span class="source raku"><span class="meta block raku"><span>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="support function raku"><span>say</span></span><span>&nbsp;</span><span class="string quoted double raku"><span class="punctuation definition string begin raku"><span>&quot;</span></span><span>MyFoo&nbsp;source&nbsp;code:</span><span class="punctuation definition string end raku"><span>&quot;</span></span></span><span>;</span></span></span></div><div class="line"><span class="source raku"><span class="meta block raku"><span>&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="support function raku"><span>say</span></span><span>&nbsp;</span><span class="meta variable container raku"><span class="variable other identifier sigil raku"><span>$</span></span><span class="support class twigil raku"><span>?</span></span><span class="variable other identifier raku"><span>DISTRIBUTION</span></span></span><span class="keyword operator generic raku"><span>.</span></span><span class="routine name raku"><span>content</span></span><span>(</span><span class="string quoted single single raku"><span class="punctuation definition string begin raku"><span>&#39;</span></span><span>lib/MyFoo.rakumod</span><span class="punctuation definition string end raku"><span>&#39;</span></span></span><span>);</span></span></span></div><div class="line"><span class="source raku"><span class="meta block raku"><span class="punctuation definition block raku"><span>}</span></span></span></span></div></pre><h2 id="Dynamic_variables"><a class="u" href="#___top" title="go to top of document">Dynamic variables</a></h2>

0 commit comments

Comments
 (0)