aboutsummaryrefslogtreecommitdiff
path: root/docs/help/indices_replicate.html
blob: 3ef36de113647c27a77023a8688b4115083e2b73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<head>
  <link href="../favicon.ico" rel="shortcut icon" type="image/x-icon"/>
  <link href="../style.css" rel="stylesheet"/>
  <title>BQN: Solidus (/)</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="solidus-"><a class="header" href="#solidus-">Solidus (<code><span class='Function'>/</span></code>)</a></h1>
<h2 id="-𝕩-indices"><a class="header" href="#-𝕩-indices"><code><span class='Function'>/</span> <span class='Value'>𝕩</span></code>: Indices</a></h2>
<p>Repeat the index of each element in <code><span class='Value'>𝕩</span></code> by the element's value. <code><span class='Value'>𝕩</span></code> must be rank 1.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=LyAx4oC/MuKAvzMKCi8gMeKAvzDigL8x">↗️</a><pre>    <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>
⟨ 0 1 1 2 2 2 ⟩

    <span class='Function'>/</span> <span class='Number'>1</span><span class='Ligature'></span><span class='Number'>0</span><span class='Ligature'></span><span class='Number'>1</span>
⟨ 0 2 ⟩
</pre>
<h2 id="𝕨--𝕩-replicate"><a class="header" href="#𝕨--𝕩-replicate"><code><span class='Value'>𝕨</span> <span class='Function'>/</span> <span class='Value'>𝕩</span></code>: Replicate</a></h2>
<p>Repeat each major cell in <code><span class='Value'>𝕩</span></code> by the corresponding element in <code><span class='Value'>𝕨</span></code>.</p>
<p>Unit <code><span class='Value'>𝕨</span></code> applies to all elements.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MyAvICJjb3B5IgoKMeKAvzDigL8xIC8gMeKAvzLigL8z">↗️</a><pre>    <span class='Number'>3</span> <span class='Function'>/</span> <span class='String'>&quot;copy&quot;</span>
"cccooopppyyy"

    <span class='Number'>1</span><span class='Ligature'></span><span class='Number'>0</span><span class='Ligature'></span><span class='Number'>1</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 3 ⟩
</pre>