aboutsummaryrefslogtreecommitdiff
path: root/docs/doc
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2022-05-27 17:39:06 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2022-05-27 17:39:12 -0400
commit3fd568e004693e447208e1842ab3b1d298eeb293 (patch)
tree81d97e58878f641905280da1e970c267025af786 /docs/doc
parent16ad28260975d42a0ad5cb790bd3884c5d293b81 (diff)
Cells modifier diagram
Diffstat (limited to 'docs/doc')
-rw-r--r--docs/doc/rank.html81
1 files changed, 81 insertions, 0 deletions
diff --git a/docs/doc/rank.html b/docs/doc/rank.html
index aef2edcd..a6752ea1 100644
--- a/docs/doc/rank.html
+++ b/docs/doc/rank.html
@@ -5,6 +5,87 @@
</head>
<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div>
<h1 id="cells-and-rank"><a class="header" href="#cells-and-rank">Cells and Rank</a></h1>
+<svg viewBox='-13.8 -12 506 240'>
+ <g font-size='18px' fill='currentColor' font-family='BQN,monospace' text-anchor='middle'>
+ <rect class='code' stroke-width='1.5' rx='12' x='0' y='0' width='478.4' height='216'/>
+ <g font-size='24px' fill='currentColor' opacity='0.9' text-anchor='start'><text dy='0.33em' x='9.2' y='0'>Cells</text></g>
+ <g transform='translate(55.2,96)'>
+ <g stroke-width='0.3' fill='none' stroke='currentColor'>
+ <rect x='-11' y='-11' width='160' height='22'/>
+ <rect x='-11' y='29' width='160' height='22'/>
+ <rect x='-11' y='69' width='160' height='22'/>
+ </g>
+ <text dy='0.33em' x='0' y='0'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='46' y='0'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='92' y='0'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='138' y='0'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='0' y='40'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='46' y='40'><tspan class='Number'>1</tspan></text>
+ <text dy='0.33em' x='92' y='40'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='138' y='40'><tspan class='Number'>5</tspan></text>
+ <text dy='0.33em' x='0' y='80'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='46' y='80'><tspan class='Number'>2</tspan></text>
+ <text dy='0.33em' x='92' y='80'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='138' y='80'><tspan class='Number'>0</tspan></text>
+ <path class='bluegreen' stroke-width='2' stroke-linecap='round' style='fill:none' opacity='0.7' d='M142 99h15v-15M3.5 -19h-22.5v22.5'/>
+ <rect stroke-width='0.3' fill='none' stroke='currentColor' x='-11' y='-55' width='160' height='22'/>
+ <path class='green' stroke-width='3' stroke-linecap='round' opacity='0.2' d='M101.2 92v-76h23l-55.2 -56l-55.2 56h23v76z'/>
+ <g font-size='24px' text-anchor='start'><text dy='0.33em' x='-46' y='-44'><tspan class='Function'>+</tspan><tspan class='Modifier'>˝</tspan></text></g>
+ <text dy='0.33em' x='0' y='-44'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='46' y='-44'><tspan class='Number'>3</tspan></text>
+ <text dy='0.33em' x='92' y='-44'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='138' y='-44'><tspan class='Number'>5</tspan></text>
+ <g font-size='24px'>
+ <text dy='0.33em' x='69' y='20'><tspan class='Function'>+</tspan></text>
+ <text dy='0.33em' x='69' y='60'><tspan class='Function'>+</tspan></text>
+ </g>
+ </g>
+ <g transform='translate(308.2,96)'>
+ <g stroke-width='0.3' fill='none' stroke='currentColor'>
+ <rect x='-11' y='-11' width='160' height='22'/>
+ <rect x='-11' y='29' width='160' height='22'/>
+ <rect x='-11' y='69' width='160' height='22'/>
+ </g>
+ <text dy='0.33em' x='0' y='0'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='46' y='0'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='92' y='0'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='138' y='0'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='0' y='40'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='46' y='40'><tspan class='Number'>1</tspan></text>
+ <text dy='0.33em' x='92' y='40'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='138' y='40'><tspan class='Number'>5</tspan></text>
+ <text dy='0.33em' x='0' y='80'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='46' y='80'><tspan class='Number'>2</tspan></text>
+ <text dy='0.33em' x='92' y='80'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='138' y='80'><tspan class='Number'>0</tspan></text>
+ <path class='bluegreen' stroke-width='2' stroke-linecap='round' style='fill:none' opacity='0.7' d='M142 99h15v-15M3.5 -19h-22.5v22.5'/>
+ <g stroke-width='0.3' fill='none' stroke='currentColor'>
+ <rect x='-57' y='-11' width='22' height='22'/>
+ <rect x='-57' y='29' width='22' height='22'/>
+ <rect x='-57' y='69' width='22' height='22'/>
+ </g>
+ <g class='green' stroke-width='3' stroke-linecap='round' opacity='0.2' style='fill:none'>
+ <path d='M147.2 0l-184 0m15 8l-15 -8l15 -8'/>
+ <path d='M147.2 40l-184 0m15 8l-15 -8l15 -8'/>
+ <path d='M147.2 80l-184 0m15 8l-15 -8l15 -8'/>
+ </g>
+ <g font-size='24px' text-anchor='start'><text dy='0.33em' x='-55.2' y='-44'><tspan class='Function'>+</tspan><tspan class='Modifier'>˝˘</tspan></text></g>
+ <text dy='0.33em' x='-46' y='0'><tspan class='Number'>0</tspan></text>
+ <text dy='0.33em' x='-46' y='40'><tspan class='Number'>6</tspan></text>
+ <text dy='0.33em' x='-46' y='80'><tspan class='Number'>2</tspan></text>
+ <text dy='0.33em' x='23' y='0'><tspan class='Function'>+</tspan></text>
+ <text dy='0.33em' x='69' y='0'><tspan class='Function'>+</tspan></text>
+ <text dy='0.33em' x='115' y='0'><tspan class='Function'>+</tspan></text>
+ <text dy='0.33em' x='23' y='40'><tspan class='Function'>+</tspan></text>
+ <text dy='0.33em' x='69' y='40'><tspan class='Function'>+</tspan></text>
+ <text dy='0.33em' x='115' y='40'><tspan class='Function'>+</tspan></text>
+ <text dy='0.33em' x='23' y='80'><tspan class='Function'>+</tspan></text>
+ <text dy='0.33em' x='69' y='80'><tspan class='Function'>+</tspan></text>
+ <text dy='0.33em' x='115' y='80'><tspan class='Function'>+</tspan></text>
+ </g>
+ </g>
+</svg>
+
<p>The Cells modifier <code><span class='Modifier'>˘</span></code> applies a function to major cells of its argument, much like <a href="map.html">Each</a> applies to elements. Each result from <code><span class='Function'>𝔽</span></code> becomes a major cell of the result, which means they must all have the same shape.</p>
<p>The Rank modifier <code><span class='Modifier2'>⎉</span></code> generalizes this concept by allowing numbers provided by <code><span class='Function'>𝔾</span></code> to specify a rank for each argument: non-negative to indicate the rank of each array passed to <code><span class='Function'>𝔽</span></code>, or negative for the number of axes that are mapped over. Cells, which maps over one axis of each argument, is identical to <code><span class='Modifier2'>⎉</span><span class='Number'>¯1</span></code>. Rank is analogous to the <a href="depth.html#the-depth-modifier">Depth modifier</a>, but the homogeneous structure of an array eliminates some tricky edge cases found in Depth.</p>
<h2 id="cells"><a class="header" href="#cells">Cells</a></h2>