aboutsummaryrefslogtreecommitdiff
path: root/docs/doc
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-06-13 22:14:24 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-06-13 22:14:24 -0400
commit4c1292ee8e27e59891a60c2f1bf3c326d4dba51f (patch)
tree44d7add7d832c490a0d9a69831e88f20dc7ede8b /docs/doc
parent7b64aec0c6c534d60b5b34195bee7a6aaf11713a (diff)
Add self-comparison function diagram
Diffstat (limited to 'docs/doc')
-rw-r--r--docs/doc/selfcmp.html126
1 files changed, 126 insertions, 0 deletions
diff --git a/docs/doc/selfcmp.html b/docs/doc/selfcmp.html
index 1374736f..9188c69c 100644
--- a/docs/doc/selfcmp.html
+++ b/docs/doc/selfcmp.html
@@ -5,6 +5,132 @@
</head>
<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="self-comparison-functions">Self-comparison functions</h1>
+<svg viewBox='-115.2 -33 676.8 299.2'>
+ <defs>
+ <mask id='m'>
+ <rect fill='white' x='-76.8' y='-24.2' width='600' height='281.6'/>
+ <g fill='black'>
+ <rect x='-7' y='-7.8' width='14' height='20'/>
+ <rect x='41' y='-7.8' width='14' height='20'/>
+ <rect x='89' y='-7.8' width='14' height='20'/>
+ <rect x='137' y='-7.8' width='14' height='20'/>
+ <rect x='185' y='-7.8' width='14' height='20'/>
+ <rect x='233' y='-7.8' width='14' height='20'/>
+ <rect x='281' y='-7.8' width='14' height='20'/>
+ <rect x='329' y='-7.8' width='14' height='20'/>
+ <rect x='377' y='-7.8' width='14' height='20'/>
+ <rect x='425' y='-7.8' width='14' height='20'/>
+ <rect x='473' y='-7.8' width='14' height='20'/>
+ <rect x='-7' y='29.6' width='14' height='20'/>
+ <rect x='41' y='29.6' width='14' height='20'/>
+ <rect x='89' y='29.6' width='14' height='20'/>
+ <rect x='137' y='29.6' width='14' height='20'/>
+ <rect x='185' y='29.6' width='14' height='20'/>
+ <rect x='233' y='29.6' width='14' height='20'/>
+ <rect x='281' y='29.6' width='14' height='20'/>
+ <rect x='329' y='29.6' width='14' height='20'/>
+ <rect x='377' y='29.6' width='14' height='20'/>
+ <rect x='425' y='29.6' width='14' height='20'/>
+ <rect x='473' y='29.6' width='14' height='20'/>
+ <rect x='-7' y='64.8' width='14' height='20'/>
+ <rect x='41' y='86.8' width='14' height='20'/>
+ <rect x='89' y='108.8' width='14' height='20'/>
+ <rect x='137' y='108.8' width='14' height='20'/>
+ <rect x='185' y='86.8' width='14' height='20'/>
+ <rect x='233' y='108.8' width='14' height='20'/>
+ <rect x='281' y='108.8' width='14' height='20'/>
+ <rect x='329' y='86.8' width='14' height='20'/>
+ <rect x='377' y='130.8' width='14' height='20'/>
+ <rect x='425' y='130.8' width='14' height='20'/>
+ <rect x='473' y='86.8' width='14' height='20'/>
+ <rect x='-7' y='166' width='14' height='20'/>
+ <rect x='41' y='166' width='14' height='20'/>
+ <rect x='89' y='166' width='14' height='20'/>
+ <rect x='137' y='166' width='14' height='20'/>
+ <rect x='185' y='166' width='14' height='20'/>
+ <rect x='233' y='166' width='14' height='20'/>
+ <rect x='281' y='166' width='14' height='20'/>
+ <rect x='329' y='166' width='14' height='20'/>
+ <rect x='377' y='166' width='14' height='20'/>
+ <rect x='425' y='166' width='14' height='20'/>
+ <rect x='473' y='166' width='14' height='20'/>
+ <rect x='-7' y='218.8' width='14' height='20'/>
+ <rect x='41' y='218.8' width='14' height='20'/>
+ <rect x='89' y='218.8' width='14' height='20'/>
+ <rect x='137' y='218.8' width='14' height='20'/>
+ </g>
+ </mask>
+ </defs>
+ <g font-family='BQN,monospace' font-size='18px' text-anchor='middle'>
+ <rect class='code' stroke-width='1.5' rx='12' x='-76.8' y='-24.2' width='600' height='281.6'/>
+ <g class='purple' stroke-width='0' opacity='0.5'>
+ <rect x='-67.2' y='24.2' width='580.8' height='30.8'/>
+ <rect x='-67.2' y='160.6' width='580.8' height='30.8'/>
+ </g>
+ <g stroke-width='0.5' stroke='currentColor' fill='none' mask='url(#m)'>
+ <path d='M0 0V182.6L0 217.8M0 74.8H499.2'/>
+ <path d='M48 0V182.6L48 217.8M48 96.8H499.2'/>
+ <path d='M96 0V182.6L96 217.8M96 118.8H499.2'/>
+ <path d='M384 0V182.6L144 217.8M384 140.8H499.2'/>
+ </g>
+ <text dy='0.32em' x='0' y='0'><tspan class='String'>'m'</tspan></text>
+ <text dy='0.32em' x='48' y='0'><tspan class='String'>'i'</tspan></text>
+ <text dy='0.32em' x='96' y='0'><tspan class='String'>'s'</tspan></text>
+ <text dy='0.32em' x='144' y='0'><tspan class='String'>'s'</tspan></text>
+ <text dy='0.32em' x='192' y='0'><tspan class='String'>'i'</tspan></text>
+ <text dy='0.32em' x='240' y='0'><tspan class='String'>'s'</tspan></text>
+ <text dy='0.32em' x='288' y='0'><tspan class='String'>'s'</tspan></text>
+ <text dy='0.32em' x='336' y='0'><tspan class='String'>'i'</tspan></text>
+ <text dy='0.32em' x='384' y='0'><tspan class='String'>'p'</tspan></text>
+ <text dy='0.32em' x='432' y='0'><tspan class='String'>'p'</tspan></text>
+ <text dy='0.32em' x='480' y='0'><tspan class='String'>'i'</tspan></text>
+ <text dy='0.32em' x='0' y='39.6'><tspan class='Number'>0</tspan></text>
+ <text dy='0.32em' x='48' y='39.6'><tspan class='Number'>1</tspan></text>
+ <text dy='0.32em' x='96' y='39.6'><tspan class='Number'>2</tspan></text>
+ <text dy='0.32em' x='144' y='39.6'><tspan class='Number'>2</tspan></text>
+ <text dy='0.32em' x='192' y='39.6'><tspan class='Number'>1</tspan></text>
+ <text dy='0.32em' x='240' y='39.6'><tspan class='Number'>2</tspan></text>
+ <text dy='0.32em' x='288' y='39.6'><tspan class='Number'>2</tspan></text>
+ <text dy='0.32em' x='336' y='39.6'><tspan class='Number'>1</tspan></text>
+ <text dy='0.32em' x='384' y='39.6'><tspan class='Number'>3</tspan></text>
+ <text dy='0.32em' x='432' y='39.6'><tspan class='Number'>3</tspan></text>
+ <text dy='0.32em' x='480' y='39.6'><tspan class='Number'>1</tspan></text>
+ <text dy='0.32em' x='0' y='74.8'><tspan class='Number'>0</tspan></text>
+ <text dy='0.32em' x='48' y='96.8'><tspan class='Number'>0</tspan></text>
+ <text dy='0.32em' x='96' y='118.8'><tspan class='Number'>0</tspan></text>
+ <text dy='0.32em' x='144' y='118.8'><tspan class='Number'>1</tspan></text>
+ <text dy='0.32em' x='192' y='96.8'><tspan class='Number'>1</tspan></text>
+ <text dy='0.32em' x='240' y='118.8'><tspan class='Number'>2</tspan></text>
+ <text dy='0.32em' x='288' y='118.8'><tspan class='Number'>3</tspan></text>
+ <text dy='0.32em' x='336' y='96.8'><tspan class='Number'>2</tspan></text>
+ <text dy='0.32em' x='384' y='140.8'><tspan class='Number'>0</tspan></text>
+ <text dy='0.32em' x='432' y='140.8'><tspan class='Number'>1</tspan></text>
+ <text dy='0.32em' x='480' y='96.8'><tspan class='Number'>3</tspan></text>
+ <text dy='0.32em' x='0' y='176'><tspan class='Number'>1</tspan></text>
+ <text dy='0.32em' x='48' y='176'><tspan class='Number'>1</tspan></text>
+ <text dy='0.32em' x='96' y='176'><tspan class='Number'>1</tspan></text>
+ <text dy='0.32em' x='144' y='176'><tspan class='Number'>0</tspan></text>
+ <text dy='0.32em' x='192' y='176'><tspan class='Number'>0</tspan></text>
+ <text dy='0.32em' x='240' y='176'><tspan class='Number'>0</tspan></text>
+ <text dy='0.32em' x='288' y='176'><tspan class='Number'>0</tspan></text>
+ <text dy='0.32em' x='336' y='176'><tspan class='Number'>0</tspan></text>
+ <text dy='0.32em' x='384' y='176'><tspan class='Number'>1</tspan></text>
+ <text dy='0.32em' x='432' y='176'><tspan class='Number'>0</tspan></text>
+ <text dy='0.32em' x='480' y='176'><tspan class='Number'>0</tspan></text>
+ <text dy='0.32em' x='0' y='228.8'><tspan class='String'>'m'</tspan></text>
+ <text dy='0.32em' x='48' y='228.8'><tspan class='String'>'i'</tspan></text>
+ <text dy='0.32em' x='96' y='228.8'><tspan class='String'>'s'</tspan></text>
+ <text dy='0.32em' x='144' y='228.8'><tspan class='String'>'p'</tspan></text>
+ <g font-size='24px'>
+ <text dy='0.32em' x='-50.4' y='-1.1'><tspan class='Value'>𝕩</tspan></text>
+ <text dy='0.32em' x='-50.4' y='38.5'><tspan class='Function'>⊐</tspan></text>
+ <text dy='0.32em' x='-50.4' y='106.7'><tspan class='Function'>⊒</tspan></text>
+ <text dy='0.32em' x='-50.4' y='174.9'><tspan class='Function'>∊</tspan></text>
+ <text dy='0.32em' x='-50.4' y='227.7'><tspan class='Function'>⍷</tspan></text>
+ </g>
+ </g>
+</svg>
+
<p>BQN has four self-comparison functions, Classify (<code><span class='Function'>⊐</span></code>), Occurrence Count (<code><span class='Function'>⊒</span></code>), Mark Firsts (<code><span class='Function'>∊</span></code>), and Deduplicate (<code><span class='Function'>⍷</span></code>). Each of these is a monadic function that obtains its result by comparing each major cell of the argument (which must have rank at least 1) to the earlier major cells with <a href="match.html">match</a>. For example, Mark Firsts indicates the cells that don't match any earlier cell, making them the first of their kind.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oiKICJhYmFhY2Ii">↗️</a><pre> <span class='Function'>∊</span> <span class='String'>&quot;abaacb&quot;</span>
⟨ 1 1 0 0 1 0 ⟩