Upgrade toolchain
This commit is contained in:
parent
0b8247cf0d
commit
5719104fd1
33 changed files with 1326 additions and 1061 deletions
|
@ -16,14 +16,18 @@
|
|||
<link rel="alternate" type="application/rss+xml" title="Dimitri Lozeve's blog" href="../rss.xml" />
|
||||
|
||||
<!-- KaTeX CSS styles -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.0/dist/katex.min.css" integrity="sha384-BdGj8xC2eZkQaxoQ8nSLefg4AV4/AwB3Fj+8SUSo7pnKP6Eoy18liIKTPn9oBYNG" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
|
||||
|
||||
<!-- The loading of KaTeX is deferred to speed up page rendering -->
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.0/dist/katex.min.js" integrity="sha384-JiKN5O8x9Hhs/UE5cT5AAJqieYlOZbGT3CHws/y97o3ty4R7/O5poG9F3JoiOYw1" crossorigin="anonymous"></script>
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js" integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></script>
|
||||
|
||||
<!-- To automatically render math in text elements, include the auto-render extension: -->
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.0/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
|
||||
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js" integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
|
||||
|
||||
|
||||
<!-- <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script> -->
|
||||
<!-- <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script> -->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<article>
|
||||
|
@ -46,7 +50,6 @@
|
|||
</header>
|
||||
|
||||
|
||||
|
||||
</article>
|
||||
|
||||
<article>
|
||||
|
@ -54,7 +57,7 @@
|
|||
|
||||
</section>
|
||||
<section>
|
||||
<h2>Table of Contents</h2><ul>
|
||||
<div id="toc"><h2>Table of Contents</h2><ul>
|
||||
<li><a href="#introduction">Introduction</a></li>
|
||||
<li><a href="#lets-split">1. Let’s Split!</a></li>
|
||||
<li><a href="#character-building">2. Character Building</a></li>
|
||||
|
@ -66,9 +69,9 @@
|
|||
<li><a href="#zigzag-numbers">8. Zigzag Numbers</a></li>
|
||||
<li><a href="#rise-and-fall">9. Rise and Fall</a></li>
|
||||
<li><a href="#stacking-it-up">10. Stacking It Up</a></li>
|
||||
</ul>
|
||||
</ul></div>
|
||||
<h2 id="introduction">Introduction</h2>
|
||||
<p>I’ve always been quite fond of <a href="https://en.wikipedia.org/wiki/APL_(programming_language)">APL</a> and its “array-oriented” approach of programming<span><label for="sn-1" class="margin-toggle sidenote-number"></label><input type="checkbox" id="sn-1" class="margin-toggle" /><span class="sidenote">See my <a href="./ising-apl.html">previous post</a> on simulating the Ising model with APL. It also contains more background on APL.<br />
|
||||
<p>I’ve always been quite fond of <a href="https://en.wikipedia.org/wiki/APL_(programming_language)">APL</a> and its “array-oriented” approach of programming<span><label for="sn-0" class="margin-toggle sidenote-number"></label><input type="checkbox" id="sn-0" class="margin-toggle" /><span class="sidenote">See my <a href="./ising-apl.html">previous post</a> on simulating the Ising model with APL. It also contains more background on APL.<br />
|
||||
<br />
|
||||
</span></span>. Every year, <a href="https://www.dyalog.com/">Dyalog</a> (the company behind probably the most popular APL implementation) organises a competition with various challenges in APL.</p>
|
||||
<p>The <a href="https://www.dyalogaplcompetition.com/">Dyalog APL Problem Solving Competition</a> consists of two phases:</p>
|
||||
|
@ -76,7 +79,7 @@
|
|||
<li>Phase I consists of 10 short puzzles (similar to what one can find on <a href="https://projecteuler.net/">Project Euler</a> or similar), that can be solved by a one-line APL function.</li>
|
||||
<li>Phase II is a collection of larger problems, that may require longer solutions and a larger context (e.g. reading and writing to files), often in a more applied setting. Problems are often inspired by existing domains, such as AI, bioinformatics, and so on.</li>
|
||||
</ul>
|
||||
<p>In 2018, I participated in the competition, entering only Phase I<span><label for="sn-2" class="margin-toggle sidenote-number"></label><input type="checkbox" id="sn-2" class="margin-toggle" /><span class="sidenote">Since I was a student at the time, I was eligible for a prize, and <a href="https://www.dyalog.com/nnews/128/456/Winners-Announced-for-the-2018-APL-Programming-Contest.htm">I won $100</a> for a 10-line submission, which is quite good!<br />
|
||||
<p>In 2018, I participated in the competition, entering only Phase I<span><label for="sn-1" class="margin-toggle sidenote-number"></label><input type="checkbox" id="sn-1" class="margin-toggle" /><span class="sidenote">Since I was a student at the time, I was eligible for a prize, and <a href="https://www.dyalog.com/nnews/128/456/Winners-Announced-for-the-2018-APL-Programming-Contest.htm">I won $100</a> for a 10-line submission, which is quite good!<br />
|
||||
<br />
|
||||
</span></span> (my solutions are on <a href="https://github.com/dlozeve/apl-competition-2018">GitHub</a>). This year, I entered in both phases. I explain my solutions to Phase I in this post. <a href="./dyalog-apl-competition-2020-phase-2.html">Another post</a> will contain annotated solutions for Phase II problems.</p>
|
||||
<p>The full code for my submission is on GitHub at <a href="https://github.com/dlozeve/apl-competition-2020">dlozeve/apl-competition-2020</a>, but everything is reproduced in this post.</p>
|
||||
|
@ -87,7 +90,7 @@
|
|||
<p>If <code>X<0</code>, the second vector contains the last <code>|X</code> elements of <code>Y</code> and the first vector contains the remaining elements.</p>
|
||||
</blockquote>
|
||||
<p><strong>Solution:</strong> <code>(0>⊣)⌽((⊂↑),(⊂↓))</code></p>
|
||||
<p>There are three nested trains here<span><label for="sn-3" class="margin-toggle sidenote-number"></label><input type="checkbox" id="sn-3" class="margin-toggle" /><span class="sidenote">Trains are nice to read (even if they are easy to abuse), and generally make for shorter dfns, which is better for Phase I.<br />
|
||||
<p>There are three nested trains here<span><label for="sn-2" class="margin-toggle sidenote-number"></label><input type="checkbox" id="sn-2" class="margin-toggle" /><span class="sidenote">Trains are nice to read (even if they are easy to abuse), and generally make for shorter dfns, which is better for Phase I.<br />
|
||||
<br />
|
||||
</span></span>. The first one, <code>((⊂↑),(⊂↓))</code>, uses the two functions <a href="https://help.dyalog.com/18.0/index.htm#Language/Primitive%20Functions/Take.htm">Take</a> (<code>↑</code>) and <a href="https://help.dyalog.com/18.0/index.htm#Language/Primitive%20Functions/Drop.htm">Drop</a> (<code>↓</code>) to build a nested array consisting of the two outputs we need. (Take and Drop already have the behaviour needed regarding negative arguments.) However, if the left argument is positive, the two arrays will not be in the correct order. So we need a way to reverse them if <code>X<0</code>.</p>
|
||||
<p>The second train <code>(0>⊣)</code> will return 1 if its left argument is positive. From this, we can use <a href="https://help.dyalog.com/18.0/index.htm#Language/Primitive%20Functions/Rotate.htm">Rotate</a> (<code>⌽</code>) to correctly order the nested array, in the last train.</p>
|
||||
|
@ -95,15 +98,15 @@
|
|||
<blockquote>
|
||||
<p>UTF-8 encodes Unicode characters using 1-4 integers for each character. Dyalog APL includes a system function, <code>⎕UCS</code>, that can convert characters into integers and integers into characters. The expression <code>'UTF-8'∘⎕UCS</code> converts between characters and UTF-8.</p>
|
||||
<p>Consider the following:</p>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode default"><code class="sourceCode default"><a class="sourceLine" id="cb1-1" title="1"> 'UTF-8'∘⎕UCS 'D¥⍺⌊○9'</a>
|
||||
<a class="sourceLine" id="cb1-2" title="2">68 194 165 226 141 186 226 140 138 226 151 139 57</a>
|
||||
<a class="sourceLine" id="cb1-3" title="3"> 'UTF-8'∘⎕UCS 68 194 165 226 141 186 226 140 138 226 151 139 57</a>
|
||||
<a class="sourceLine" id="cb1-4" title="4">D¥⍺⌊○9</a></code></pre></div>
|
||||
<div class="sourceCode" id="cb1"><pre class="sourceCode default"><code class="sourceCode default"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true"></a> 'UTF-8'∘⎕UCS 'D¥⍺⌊○9'</span>
|
||||
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true"></a>68 194 165 226 141 186 226 140 138 226 151 139 57</span>
|
||||
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true"></a> 'UTF-8'∘⎕UCS 68 194 165 226 141 186 226 140 138 226 151 139 57</span>
|
||||
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true"></a>D¥⍺⌊○9</span></code></pre></div>
|
||||
<p>How many integers does each character use?</p>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode default"><code class="sourceCode default"><a class="sourceLine" id="cb2-1" title="1"> 'UTF-8'∘⎕UCS¨ 'D¥⍺⌊○9' ⍝ using ]Boxing on</a>
|
||||
<a class="sourceLine" id="cb2-2" title="2">┌──┬───────┬───────────┬───────────┬───────────┬──┐</a>
|
||||
<a class="sourceLine" id="cb2-3" title="3">│68│194 165│226 141 186│226 140 138│226 151 139│57│</a>
|
||||
<a class="sourceLine" id="cb2-4" title="4">└──┴───────┴───────────┴───────────┴───────────┴──┘ </a></code></pre></div>
|
||||
<div class="sourceCode" id="cb2"><pre class="sourceCode default"><code class="sourceCode default"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true"></a> 'UTF-8'∘⎕UCS¨ 'D¥⍺⌊○9' ⍝ using ]Boxing on</span>
|
||||
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true"></a>┌──┬───────┬───────────┬───────────┬───────────┬──┐</span>
|
||||
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true"></a>│68│194 165│226 141 186│226 140 138│226 151 139│57│</span>
|
||||
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true"></a>└──┴───────┴───────────┴───────────┴───────────┴──┘ </span></code></pre></div>
|
||||
<p>The rule is that an integer in the range 128 to 191 (inclusive) continues the character of the previous integer (which may itself be a continuation). With that in mind, write a function that, given a right argument which is a simple integer vector representing valid UTF-8 text, encloses each sequence of integers that represent a single character, like the result of <code>'UTF-8'∘⎕UCS¨'UTF-8'∘⎕UCS</code> but does not use any system functions (names beginning with <code>⎕</code>)</p>
|
||||
</blockquote>
|
||||
<p><strong>Solution:</strong> <code>{(~⍵∊127+⍳64)⊂⍵}</code></p>
|
||||
|
@ -132,7 +135,7 @@
|
|||
<p>Write a function that, given a right argument of 2 integers, returns a vector of the integers from the first element of the right argument to the second, inclusively.</p>
|
||||
</blockquote>
|
||||
<p><strong>Solution:</strong> <code>{(⊃⍵)+(-×-/⍵)×0,⍳|-/⍵}</code></p>
|
||||
<p>First, we have to compute the range of the output, which is the absolute value of the difference between the two integers <code>|-/⍵</code>. From this, we compute the actual sequence, including zero<span><label for="sn-4" class="margin-toggle sidenote-number"></label><input type="checkbox" id="sn-4" class="margin-toggle" /><span class="sidenote">If we had <code>⎕IO←0</code>, we could have written <code>⍳|1+-/⍵</code>, but this is the same number of characters.<br />
|
||||
<p>First, we have to compute the range of the output, which is the absolute value of the difference between the two integers <code>|-/⍵</code>. From this, we compute the actual sequence, including zero<span><label for="sn-3" class="margin-toggle sidenote-number"></label><input type="checkbox" id="sn-3" class="margin-toggle" /><span class="sidenote">If we had <code>⎕IO←0</code>, we could have written <code>⍳|1+-/⍵</code>, but this is the same number of characters.<br />
|
||||
<br />
|
||||
</span></span>: <code>0,⍳|-/⍵</code>.</p>
|
||||
<p>This sequence will always be nondecreasing, but we have to make it decreasing if needed, so we multiply it by the opposite of the sign of <code>-/⍵</code>. Finally, we just have to start the sequence at the first element of <code>⍵</code>.</p>
|
||||
|
@ -168,44 +171,44 @@
|
|||
</blockquote>
|
||||
<p><strong>Solution:</strong> <code>{∧/(⍳∘≢≡⍋)¨(⊂((⊢⍳⌈/)↑⊢),⍵),⊂⌽((⊢⍳⌈/)↓⊢),⍵}</code></p>
|
||||
<p>How do we approach this? First we have to split the vector at the “apex”. The train <code>(⊢⍳⌈/)</code> will return the <a href="https://help.dyalog.com/latest/#Language/Primitive%20Functions/Index%20Of.htm">index of</a> (<code>⍳</code>) the maximum element.</p>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode default"><code class="sourceCode default"><a class="sourceLine" id="cb3-1" title="1"> (⊢⍳⌈/)1 3 3 4 5 2 1</a>
|
||||
<a class="sourceLine" id="cb3-2" title="2">5</a></code></pre></div>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode default"><code class="sourceCode default"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true"></a> (⊢⍳⌈/)1 3 3 4 5 2 1</span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true"></a>5</span></code></pre></div>
|
||||
<p>Combined with <a href="https://help.dyalog.com/latest/#Language/Primitive%20Functions/Take.htm">Take</a> (<code>↑</code>) and <a href="https://help.dyalog.com/latest/#Language/Primitive%20Functions/Drop.htm">Drop</a> (<code>↓</code>), we build a two-element vector containing both parts, in ascending order (we <a href="https://help.dyalog.com/latest/#Language/Primitive%20Functions/Reverse.htm">Reverse</a> (<code>⌽</code>) one of them). Note that we have to <a href="https://help.dyalog.com/latest/#Language/Primitive%20Functions/Ravel.htm">Ravel</a> (<code>,</code>) the argument to avoid rank errors in Index Of.</p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode default"><code class="sourceCode default"><a class="sourceLine" id="cb4-1" title="1"> {(⊂((⊢⍳⌈/)↑⊢),⍵),⊂⌽((⊢⍳⌈/)↓⊢),⍵}1 3 3 4 5 2 1</a>
|
||||
<a class="sourceLine" id="cb4-2" title="2">┌─────────┬───┐</a>
|
||||
<a class="sourceLine" id="cb4-3" title="3">│1 3 3 4 5│1 2│</a>
|
||||
<a class="sourceLine" id="cb4-4" title="4">└─────────┴───┘</a></code></pre></div>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode default"><code class="sourceCode default"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true"></a> {(⊂((⊢⍳⌈/)↑⊢),⍵),⊂⌽((⊢⍳⌈/)↓⊢),⍵}1 3 3 4 5 2 1</span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true"></a>┌─────────┬───┐</span>
|
||||
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true"></a>│1 3 3 4 5│1 2│</span>
|
||||
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true"></a>└─────────┴───┘</span></code></pre></div>
|
||||
<p>Next, <code>(⍳∘≢≡⍋)</code> on each of the two vectors will test if they are non-decreasing (i.e. if the ranks of all the elements correspond to a simple range from 1 to the size of the vector).</p>
|
||||
<h2 id="stacking-it-up">10. Stacking It Up</h2>
|
||||
<blockquote>
|
||||
<p>Write a function that takes as its right argument a vector of simple arrays of rank 2 or less (scalar, vector, or matrix). Each simple array will consist of either non-negative integers or printable ASCII characters. The function must return a simple character array that displays identically to what <code>{⎕←⍵}¨</code> displays when applied to the right argument.</p>
|
||||
</blockquote>
|
||||
<p><strong>Solution:</strong> <code>{↑⊃,/↓¨⍕¨⍵}</code></p>
|
||||
<p>The first step is to <a href="https://help.dyalog.com/latest/#Language/Primitive%20Functions/Format%20Monadic.htm">Format</a> (<code>⍕</code>) everything to get strings.<span><label for="sn-5" class="margin-toggle">⊕</label><input type="checkbox" id="sn-5" class="margin-toggle" /><span class="marginnote"> A lot of trial-and-error is always necessary when dealing with nested arrays, and this being about formatting exacerbates the problem.<br />
|
||||
<p>The first step is to <a href="https://help.dyalog.com/latest/#Language/Primitive%20Functions/Format%20Monadic.htm">Format</a> (<code>⍕</code>) everything to get strings.<span><label for="sn-4" class="margin-toggle">⊕</label><input type="checkbox" id="sn-4" class="margin-toggle" /><span class="marginnote"> A lot of trial-and-error is always necessary when dealing with nested arrays, and this being about formatting exacerbates the problem.<br />
|
||||
<br />
|
||||
</span></span> The next step would be to “stack everything vertically”, so we will need <a href="https://help.dyalog.com/latest/#Language/Primitive%20Functions/Mix.htm">Mix</a> (<code>↑</code>) at some point. However, if we do it immediately we don’t get the correct result:</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode default"><code class="sourceCode default"><a class="sourceLine" id="cb5-1" title="1"> {↑⍕¨⍵}(3 3⍴⍳9)(↑'Adam' 'Michael')</a>
|
||||
<a class="sourceLine" id="cb5-2" title="2">1 2 3 </a>
|
||||
<a class="sourceLine" id="cb5-3" title="3">4 5 6 </a>
|
||||
<a class="sourceLine" id="cb5-4" title="4">7 8 9 </a>
|
||||
<a class="sourceLine" id="cb5-5" title="5"></a>
|
||||
<a class="sourceLine" id="cb5-6" title="6">Adam </a>
|
||||
<a class="sourceLine" id="cb5-7" title="7">Michael</a></code></pre></div>
|
||||
<p>Mix is padding with spaces both horizontally (necessary as we want the output to be a simple array of characters) and vertically (not what we want). We will have to decompose everything line by line, and then mix all the lines together. This is exactly what <a href="https://help.dyalog.com/latest/#Language/Primitive%20Functions/Split.htm">Split</a><span><label for="sn-6" class="margin-toggle sidenote-number"></label><input type="checkbox" id="sn-6" class="margin-toggle" /><span class="sidenote">Split is the dual of Mix.<br />
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode default"><code class="sourceCode default"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true"></a> {↑⍕¨⍵}(3 3⍴⍳9)(↑'Adam' 'Michael')</span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true"></a>1 2 3 </span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true"></a>4 5 6 </span>
|
||||
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true"></a>7 8 9 </span>
|
||||
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true"></a></span>
|
||||
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true"></a>Adam </span>
|
||||
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true"></a>Michael</span></code></pre></div>
|
||||
<p>Mix is padding with spaces both horizontally (necessary as we want the output to be a simple array of characters) and vertically (not what we want). We will have to decompose everything line by line, and then mix all the lines together. This is exactly what <a href="https://help.dyalog.com/latest/#Language/Primitive%20Functions/Split.htm">Split</a><span><label for="sn-5" class="margin-toggle sidenote-number"></label><input type="checkbox" id="sn-5" class="margin-toggle" /><span class="sidenote">Split is the dual of Mix.<br />
|
||||
<br />
|
||||
</span></span> (<code>↓</code>) does:</p>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode default"><code class="sourceCode default"><a class="sourceLine" id="cb6-1" title="1"> {↓¨⍕¨⍵}(3 3⍴⍳9)(↑'Adam' 'Michael')(⍳10) '*'(5 5⍴⍳25)</a>
|
||||
<a class="sourceLine" id="cb6-2" title="2">┌───────────────────┬─────────────────┬──────────────────────┬─┬───────────────</a>
|
||||
<a class="sourceLine" id="cb6-3" title="3">│┌─────┬─────┬─────┐│┌───────┬───────┐│┌────────────────────┐│*│┌──────────────</a>
|
||||
<a class="sourceLine" id="cb6-4" title="4">││1 2 3│4 5 6│7 8 9│││Adam │Michael│││1 2 3 4 5 6 7 8 9 10││ ││ 1 2 3 4 5</a>
|
||||
<a class="sourceLine" id="cb6-5" title="5">│└─────┴─────┴─────┘│└───────┴───────┘│└────────────────────┘│ │└──────────────</a>
|
||||
<a class="sourceLine" id="cb6-6" title="6">└───────────────────┴─────────────────┴──────────────────────┴─┴───────────────</a>
|
||||
<a class="sourceLine" id="cb6-7" title="7"></a>
|
||||
<a class="sourceLine" id="cb6-8" title="8"> ─────────────────────────────────────────────────────────────┐</a>
|
||||
<a class="sourceLine" id="cb6-9" title="9"> ┬──────────────┬──────────────┬──────────────┬──────────────┐│</a>
|
||||
<a class="sourceLine" id="cb6-10" title="10"> │ 6 7 8 9 10│11 12 13 14 15│16 17 18 19 20│21 22 23 24 25││</a>
|
||||
<a class="sourceLine" id="cb6-11" title="11"> ┴──────────────┴──────────────┴──────────────┴──────────────┘│</a>
|
||||
<a class="sourceLine" id="cb6-12" title="12"> ─────────────────────────────────────────────────────────────┘</a></code></pre></div>
|
||||
<div class="sourceCode" id="cb6"><pre class="sourceCode default"><code class="sourceCode default"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true"></a> {↓¨⍕¨⍵}(3 3⍴⍳9)(↑'Adam' 'Michael')(⍳10) '*'(5 5⍴⍳25)</span>
|
||||
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true"></a>┌───────────────────┬─────────────────┬──────────────────────┬─┬───────────────</span>
|
||||
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true"></a>│┌─────┬─────┬─────┐│┌───────┬───────┐│┌────────────────────┐│*│┌──────────────</span>
|
||||
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true"></a>││1 2 3│4 5 6│7 8 9│││Adam │Michael│││1 2 3 4 5 6 7 8 9 10││ ││ 1 2 3 4 5</span>
|
||||
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true"></a>│└─────┴─────┴─────┘│└───────┴───────┘│└────────────────────┘│ │└──────────────</span>
|
||||
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true"></a>└───────────────────┴─────────────────┴──────────────────────┴─┴───────────────</span>
|
||||
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true"></a></span>
|
||||
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true"></a> ─────────────────────────────────────────────────────────────┐</span>
|
||||
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true"></a> ┬──────────────┬──────────────┬──────────────┬──────────────┐│</span>
|
||||
<span id="cb6-10"><a href="#cb6-10" aria-hidden="true"></a> │ 6 7 8 9 10│11 12 13 14 15│16 17 18 19 20│21 22 23 24 25││</span>
|
||||
<span id="cb6-11"><a href="#cb6-11" aria-hidden="true"></a> ┴──────────────┴──────────────┴──────────────┴──────────────┘│</span>
|
||||
<span id="cb6-12"><a href="#cb6-12" aria-hidden="true"></a> ─────────────────────────────────────────────────────────────┘</span></code></pre></div>
|
||||
<p>Next, we clean this up with Ravel (<code>,</code>) and we can Mix to obtain the final result.</p>
|
||||
</section>
|
||||
</article>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue