diff options
Diffstat (limited to 'docs/help/deshape_reshape.html')
| -rw-r--r-- | docs/help/deshape_reshape.html | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/docs/help/deshape_reshape.html b/docs/help/deshape_reshape.html new file mode 100644 index 00000000..fa7992a9 --- /dev/null +++ b/docs/help/deshape_reshape.html @@ -0,0 +1,45 @@ +<head> + <link href="../favicon.ico" rel="shortcut icon" type="image/x-icon"/> + <link href="../style.css" rel="stylesheet"/> + <title>BQN: Barb (`⥊`)</title> +</head> +<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">help</a></div> +<h1 id="barb-"><a class="header" href="#barb-">Barb (<code><span class='Function'>⥊</span></code>)</a></h1> +<h2 id="--deshape--"><a class="header" href="#--deshape--"><code><span class='Function'>⥊</span> <span class='Value'>𝕩</span></code>: Deshape</a></h2> +<p>Put all elements of <code><span class='Value'>𝕩</span></code> in a rank 1 array, converting to array if necessary.</p> +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=ICAgICAg4qWKIDEKCiAgICAgIOKliiAx4oC/MiDiiY0gM+KAvzQ=">↗️</a><pre> <span class='Function'>⥊</span> <span class='Number'>1</span> +⟨ 1 ⟩ + + <span class='Function'>⥊</span> <span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>2</span> <span class='Function'>≍</span> <span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>4</span> +⟨ 1 2 3 4 ⟩ +</pre> +<h2 id="---reshape"><a class="header" href="#---reshape"><code><span class='Value'>𝕨</span> <span class='Function'>⥊</span> <span class='Value'>𝕩</span></code>: Reshape</a></h2> +<p>Put all elements of <code><span class='Value'>𝕩</span></code> in an array of shape <code><span class='Value'>𝕨</span></code>, adding or removing elements if necessary.</p> +<p>A single element in <code><span class='Value'>𝕩</span></code> can be a function, which will be replaced with an appropriate length:</p> +<ul> +<li><code><span class='Modifier2'>∘</span></code> Exact fit</li> +<li><code><span class='Function'>⌊</span></code> Round length down, discarding elements</li> +<li><code><span class='Function'>⌽</span></code> Round length up</li> +<li><code><span class='Function'>↑</span></code> Round length up, and use element fill to add extra elements.</li> +</ul> +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=ICAgICAgM+KAvzMg4qWKIDMKCiAgICAgIDLigL/ijL3igL8yIOKliiAx4oC/MuKAvzMKCiAgICAgIDLigL/ihpHigL8yIOKliiAx4oC/MuKAvzM=">↗️</a><pre> <span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>3</span> <span class='Function'>⥊</span> <span class='Number'>3</span> +┌─ +╵ 3 3 3 + 3 3 3 + 3 3 3 + ┘ + + <span class='Number'>2</span><span class='Ligature'>‿</span><span class='Function'>⌽</span><span class='Ligature'>‿</span><span class='Number'>2</span> <span class='Function'>⥊</span> <span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>3</span> +┌─ +╎ 1 2 + + 3 1 + ┘ + + <span class='Number'>2</span><span class='Ligature'>‿</span><span class='Function'>↑</span><span class='Ligature'>‿</span><span class='Number'>2</span> <span class='Function'>⥊</span> <span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>3</span> +┌─ +╎ 1 2 + + 3 0 + ┘ +</pre> |
