aboutsummaryrefslogtreecommitdiff
path: root/docs/doc/group.html
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-06-07 22:22:38 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-06-07 22:22:38 -0400
commit59f4d13ef3ca09dd17bc561a303aabd2432fbe41 (patch)
tree78da866c19dbe47dcd06b72b9a490aa81db16925 /docs/doc/group.html
parentb4959538e555bfa9c21a75269837f34582100a14 (diff)
Group graphic
Diffstat (limited to 'docs/doc/group.html')
-rw-r--r--docs/doc/group.html22
1 files changed, 22 insertions, 0 deletions
diff --git a/docs/doc/group.html b/docs/doc/group.html
index 2b03e5fa..c4471132 100644
--- a/docs/doc/group.html
+++ b/docs/doc/group.html
@@ -6,6 +6,28 @@
<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div>
<h1 id="group">Group</h1>
<p>BQN replaces the <a href="https://aplwiki.com/wiki/Key">Key</a> operator from J or Dyalog APL, and <a href="https://aplwiki.com/wiki/Partition_representations">many forms of partitioning</a>, with a single (ambivalent) Group function <code><span class='Function'>⊔</span></code>. This function is somewhat related to the K function <code><span class='Function'>=</span></code> of the same name, but results in an array rather than a dictionary.</p>
+<svg viewBox='-344 -105 640 210'>
+ <g text-anchor='middle' font-family='BQN,monospace'>
+ <rect class='code' stroke-width='1' rx='12' x='-280' y='-102.2' width='512' height='204.4'/>
+ <g font-size='18px'><text x='-160' y='-72.8'><tspan class='Number'>0</tspan></text><text x='-80' y='-72.8'><tspan class='Number'>¯1</tspan></text><text x='0' y='-72.8'><tspan class='Number'>¯1</tspan></text><text x='80' y='-72.8'><tspan class='Number'>2</tspan></text><text x='160' y='-72.8'><tspan class='Number'>0</tspan></text><text x='-160' y='-44.8'><tspan class='String'>"zero"</tspan></text><text x='-80' y='-44.8'><tspan class='String'>"one"</tspan></text><text x='0' y='-44.8'><tspan class='String'>"two"</tspan></text><text x='80' y='-44.8'><tspan class='String'>"three"</tspan></text><text x='160' y='-44.8'><tspan class='String'>"four"</tspan></text><text x='-128' y='39.2'><tspan class='String'>"zero"</tspan></text><text x='-48' y='39.2'><tspan class='String'>"four"</tspan></text><text x='128' y='39.2'><tspan class='String'>"three"</tspan></text><text x='-88' y='81.2'><tspan class='Number'>0</tspan></text><text x='40' y='81.2'><tspan class='Number'>1</tspan></text><text x='128' y='81.2'><tspan class='Number'>2</tspan></text></g>
+ <g text-anchor='end' font-size='16px'>
+ <text x='-224' y='-72.8'><tspan class='Value'>𝕨</tspan></text>
+ <text x='-224' y='-44.8'><tspan class='Value'>𝕩</tspan></text>
+ <text x='-224' y='39.2'><tspan class='Value'>𝕨</tspan><tspan class='Function'>⊔</tspan><tspan class='Value'>𝕩</tspan></text>
+ </g>
+ <g class='yellow' stroke-width='1'>
+ <line x1='-160' x2='-128' y1='-39.2' y2='25.2'/>
+ <line x1='160' x2='-48' y1='-39.2' y2='25.2'/>
+ <line x1='80' x2='128' y1='-39.2' y2='25.2'/>
+ </g>
+ <g class='green' stroke-width='1' style='fill:none'>
+ <path d='M-176 25.2v28h176v-28'/>
+ <path d='M24 25.2v28h32v-28'/>
+ <path d='M80 25.2v28h96v-28'/>
+ </g>
+ </g>
+</svg>
+
<h2 id="definition">Definition</h2>
<p>Group operates on a list of atomic-number <a href="indices.html">indices</a> <code><span class='Value'>𝕨</span></code> and an array <code><span class='Value'>𝕩</span></code>, treated as a list of its major cells, to produce a list of groups, each containing some of the cells from <code><span class='Value'>𝕩</span></code>. The two arguments have the same length, and each cell in <code><span class='Value'>𝕩</span></code> is paired with the index in <code><span class='Value'>𝕨</span></code> at the same position, which indicates which result group should include that cell.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MOKAvzHigL8y4oC/MOKAvzEg4omNICJhYmNkZSIgICMgQ29ycmVzcG9uZGluZyBpbmRpY2VzIGFuZCB2YWx1ZXMKMOKAvzHigL8y4oC/MOKAvzEg4oqUICJhYmNkZSIgICMgVmFsdWVzIGdyb3VwZWQgYnkgaW5kZXg=">↗️</a><pre> <span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>2</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='String'>&quot;abcde&quot;</span> <span class='Comment'># Corresponding indices and values