aboutsummaryrefslogtreecommitdiff
path: root/docs/doc
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doc')
-rw-r--r--docs/doc/order.html57
1 files changed, 57 insertions, 0 deletions
diff --git a/docs/doc/order.html b/docs/doc/order.html
index af62ea0a..22e25663 100644
--- a/docs/doc/order.html
+++ b/docs/doc/order.html
@@ -189,6 +189,63 @@
"210dcbaEDCBA"
</pre>
<h2 id="bins"><a class="header" href="#bins">Bins</a></h2>
+<svg viewBox='-168 -13.6 570 258.4'>
+ <g font-family='BQN,monospace' font-size='22px' text-anchor='middle'>
+ <rect class='code' stroke-width='1.5' rx='12' x='-108' y='0' width='450' height='231.2'/>
+ <g class='lilac' stroke-width='2' stroke-linecap='round'>
+ <line x1='23.244' x2='0.756' y1='68' y2='127.16'/>
+ <line x1='141.354' x2='62.646' y1='68' y2='127.16'/>
+ <line x1='-31.087' x2='115.087' y1='68' y2='127.16'/>
+ <line x1='28.913' x2='175.087' y1='68' y2='127.16'/>
+ <line x1='30.803' x2='233.197' y1='68' y2='127.16'/>
+ <line x1='207.024' x2='296.976' y1='68' y2='127.16'/>
+ <line x1='0' x2='0' y1='160.48' y2='183.6'/>
+ <line x1='60' x2='60' y1='160.48' y2='183.6'/>
+ <line x1='120' x2='120' y1='160.48' y2='183.6'/>
+ <line x1='180' x2='180' y1='160.48' y2='183.6'/>
+ <line x1='240' x2='240' y1='160.48' y2='183.6'/>
+ <line x1='300' x2='300' y1='160.48' y2='183.6'/>
+ </g>
+ <path class='green' style='fill:none' stroke-width='2' stroke-linecap='round' opacity='0.9' d='M-66.6 61.2h7.2m6 0h7.2m6 0h24m6 -18v21v-3h54m6 -18v21v-3h54m6 -18v21v-3h54m6 -18v21v-3h60m6 0h7.2m6 0h7.2'/>
+ <g fill='currentColor' font-size='22'>
+ <g class='String'>
+ <text dy='0.32em' x='0' y='34'>'b'</text>
+ <text dy='0.32em' x='60' y='34'>'i'</text>
+ <text dy='0.32em' x='120' y='34'>'n'</text>
+ <text dy='0.32em' x='180' y='34'>'s'</text>
+ </g>
+ <g class='String'>
+ <text dy='0.32em' x='0' y='142.8'>'g'</text>
+ <text dy='0.32em' x='60' y='142.8'>'r'</text>
+ <text dy='0.32em' x='120' y='142.8'>'a'</text>
+ <text dy='0.32em' x='180' y='142.8'>'d'</text>
+ <text dy='0.32em' x='240' y='142.8'>'e'</text>
+ <text dy='0.32em' x='300' y='142.8'>'s'</text>
+ </g>
+ <g class='Number'>
+ <text dy='0.32em' x='0' y='197.2'>1</text>
+ <text dy='0.32em' x='60' y='197.2'>3</text>
+ <text dy='0.32em' x='120' y='197.2'>0</text>
+ <text dy='0.32em' x='180' y='197.2'>1</text>
+ <text dy='0.32em' x='240' y='197.2'>1</text>
+ <text dy='0.32em' x='300' y='197.2'>4</text>
+ </g>
+ </g>
+ <g fill='currentColor' font-size='16' opacity='0.8' class='Number'>
+ <text dy='0.32em' x='-36' y='51'>0</text>
+ <text dy='0.32em' x='24' y='51'>1</text>
+ <text dy='0.32em' x='84' y='51'>2</text>
+ <text dy='0.32em' x='144' y='51'>3</text>
+ <text dy='0.32em' x='204' y='51'>4</text>
+ </g>
+ <g font-size='18px' text-anchor='end'>
+ <text dy='0.32em' x='-48' y='34'><tspan class='Value'>𝕨</tspan></text>
+ <text dy='0.32em' x='-48' y='142.8'><tspan class='Value'>𝕩</tspan></text>
+ <text dy='0.32em' x='-48' y='197.2'><tspan class='Value'>𝕨</tspan><tspan class='Function'>⍋</tspan><tspan class='Value'>𝕩</tspan></text>
+ </g>
+ </g>
+</svg>
+
<p>The two Bins functions are written with the same symbols <code><span class='Function'>⍋</span></code> and <code><span class='Function'>⍒</span></code> as Grade, but take two arguments instead of one. More complicated? A little, but once you understand Bins you'll find that it's a basic concept that shows up in the real world all the time.</p>
<p>Bins behaves like a <a href="search.html">search function</a> with respect to rank: it looks up <a href="array.html#cells">cells</a> from <code><span class='Value'>𝕩</span></code> relative to major cells of <code><span class='Value'>𝕨</span></code>. However, there's an extra requirement: the left argument to Bins must already be sorted according to whichever ordering is used. If it isn't, you'll get an error.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=NeKAvzbigL8y4oC/NOKAvzEg4o2LIDMKCjDigL8z4oC/NOKAvzfigL85IOKNkiAz">↗️</a><pre> <span class='Number'>5</span><span class='Ligature'>‿</span><span class='Number'>6</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>1</span> <span class='Function'>⍋</span> <span class='Number'>3</span>