aboutsummaryrefslogtreecommitdiff
path: root/docs/tutorial/combinator.html
blob: abfcfbe0e40377052a1d57423a13fc2ca594c915 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
<head>
  <link href="../favicon.ico" rel="shortcut icon" type="image/x-icon"/>
  <link href="../style.css" rel="stylesheet"/>
  <title>BQN Tutorial: Combinators</title>
</head>
<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">tutorial</a></div>
<h1 id="tutorial-combinators"><a class="header" href="#tutorial-combinators">Tutorial: Combinators</a></h1>
<p>BQN has a normal enough curly-brace syntax for functions and so on. I don't want to talk about it just yet. Before you get to thinking about how to write <a href="http://www.pbm.com/~lindahl/real.programmers.html">FORTRAN in any language</a> in BQN, let's see if we can acquire some instincts about idiomatic BQN the way that only being stuck in a tightly restricted and horribly confining programming environment can accomplish.</p>
<p>There are benefits to being tightly restricted and horribly confined! In programming. I don't just mean that it forces you to learn new techniques like I said, I mean that using the restricted style we will learn is actually a better way to write portions of a program. This is because a restriction you apply in one part of a program is a promise you can rely on in the rest of the program. So what are we giving up, and what can we rely on in return?</p>
<p><em>Tacit programming</em> does not use variables during the execution of a function (but you might use them for convenience in order to <em>construct</em> a tacit program). Variables allow you to use any accessible value in the program with the same level of ease. Tacit code doesn't. In fact it becomes pretty unusable when more than about three values are active at once. One consequence is that tacit code won't cause confusion by modifying far-away variables. But something unique to the tacit paradigm is that when only a small number of values are active—which is always true in a small enough portion of a program!—it has more powerful ways to describe the way these values flow through the program. The main way it achieves this is with combinators.</p>
<h2 id="whats-a-combinator"><a class="header" href="#whats-a-combinator">What's a combinator?</a></h2>
<p>(It's when you can't stop adding suffixes to &quot;combine&quot;). In the first tutorial, we briefly presented three <em>combinators</em>, <code><span class='Modifier2'></span></code>, <code><span class='Modifier'>˜</span></code>, and <code><span class='Modifier'>˙</span></code>. These are functions or modifiers that produce a result from their inputs (arguments or operands) only by applying functions to arguments. For example, let's look at a composition:</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=fOKImC0gNg==">↗️</a><pre>    <span class='Function'>|</span><span class='Modifier2'></span><span class='Function'>-</span> <span class='Number'>6</span>
6
</pre>
<p>This composition starts with the three values <code><span class='Function'>|</span></code>, <code><span class='Function'>-</span></code>, and <code><span class='Number'>6</span></code>. To produce its result, it first applies <code><span class='Function'>-</span></code> to <code><span class='Number'>6</span></code>, giving <code><span class='Number'>¯6</span></code>, a new value that it's free to use later. Then it applies <code><span class='Function'>|</span></code> to <code><span class='Number'>¯6</span></code>, giving <code><span class='Number'>6</span></code> again. Bit of a waste.</p>
<p>In BQN's combinators, the result of a function application is never used as a function itself. This allows us to use a graphic like the one below to represent a combinator. In each graph, function applications are illustrated with the name of the function linked by yellow lines to its arguments below (this is the same view as the expression diagrams we've been using, flipped upside down and cleaned up a little).</p>
<svg viewBox='-191 0 672 270'>
  <g font-size='20px' text-anchor='middle' transform='translate(145,20)'>
    <rect class='code' stroke-width='1' rx='12' x='-120.4' y='1' width='240.8' height='205'/>
    <text dy='0.32em' y='223' fill='currentColor'>Atop</text>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(-60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L0 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 57L0 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='0' y='57'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='0' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Value'>𝕨</tspan> <tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L0 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 57L-32 114'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 57L32 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='114'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='0' y='57'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='-32' y='114'><tspan class='Value'>𝕨</tspan></text>
      <text dy='0.32em' x='32' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
  </g>
</svg>

<p>The expression <code><span class='Function'>|</span><span class='Modifier2'></span><span class='Function'>-</span> <span class='Number'>6</span></code> matches <code><span class='Function'>𝔽</span><span class='Modifier2'></span><span class='Function'>𝔾</span> <span class='Value'>𝕩</span></code> on the left: to evaluate we would start with <code><span class='Value'>𝕩</span></code>, which is <code><span class='Number'>6</span></code>, at the bottom, then apply <code><span class='Function'>𝔾</span></code> or <code><span class='Function'>-</span></code>, then <code><span class='Function'>𝔽</span></code> or <code><span class='Function'>|</span></code>. However, we can see at the right that <code><span class='Function'>|</span><span class='Modifier2'></span><span class='Function'>-</span></code> might also be called with two arguments: in this case it is <code><span class='Function'>𝔾</span></code> or <code><span class='Function'>-</span></code> at the bottom that receives both arguments.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=NyB84oiYLSA5">↗️</a><pre>    <span class='Number'>7</span> <span class='Function'>|</span><span class='Modifier2'></span><span class='Function'>-</span> <span class='Number'>9</span>
2
</pre>
<p>So <code><span class='Function'>|</span><span class='Modifier2'></span><span class='Function'>-</span></code> is the absolute difference: a useful function for a change! If we have two points represented as lists of numbers, we can go further: the <em>sum</em> of absolute differences is the <a href="https://en.wikipedia.org/wiki/Taxicab_geometry">Manhattan distance</a> between them.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MTTigL84IHziiJgtIDE54oC/NgoxNOKAvzggK8K04oiYfOKImC0gMTnigL82">↗️</a><pre>    <span class='Number'>14</span><span class='Ligature'></span><span class='Number'>8</span> <span class='Function'>|</span><span class='Modifier2'></span><span class='Function'>-</span> <span class='Number'>19</span><span class='Ligature'></span><span class='Number'>6</span>
⟨ 5 2 ⟩
    <span class='Number'>14</span><span class='Ligature'></span><span class='Number'>8</span> <span class='Function'>+</span><span class='Modifier'>´</span><span class='Modifier2'></span><span class='Function'>|</span><span class='Modifier2'></span><span class='Function'>-</span> <span class='Number'>19</span><span class='Ligature'></span><span class='Number'>6</span>
7
</pre>
<p>This means that if you are at 14th and 8th, and want to get to 19th and 6th, or vice-versa, you must walk at least seven blocks total: five to get from 14th to 19th and two from 8th to 6th, not necessarily in that order. The function <code><span class='Function'>+</span><span class='Modifier'>´</span><span class='Modifier2'></span><span class='Function'>|</span><span class='Modifier2'></span><span class='Function'>-</span></code> actually uses both cases of <code><span class='Modifier2'></span></code>: the one-argument case for <code><span class='Function'>+</span><span class='Modifier'>´</span><span class='Modifier2'></span><span class='Function'>|</span></code>, and the two argument case for the <code><span class='Modifier2'></span><span class='Function'>-</span></code> part.</p>
<table class='primitives'>
  <tr>
    <td><span class='Modifier'>˜</span></td>
    <td><kbd>\`</kbd></td>
    <td>Self</td>
    <td>Swap</td>
  </tr>
  <tr>
    <td><span class='Modifier'>˙</span></td>
    <td><kbd>\"</kbd></td>
    <td colspan='2'>Constant</td>
  </tr>
  <tr>
    <td><span class='Modifier2'></span></td>
    <td><kbd>\j</kbd></td>
    <td colspan='2'>Atop</td>
  </tr>
</table>

<p>We've seen three combinators so far: Atop (<code><span class='Modifier2'></span></code>), Self/Swap (<code><span class='Modifier'>˜</span></code>), and Constant (<code><span class='Modifier'>˙</span></code>). The 1-modifiers are much simpler than Atop, as they only have a single function to call, and Constant never even calls it! Other 1-modifier combinators are possible—for example one that calls its operand twice—but not particularly useful (the Repeat modifier <code><span class='Modifier2'></span></code> is much more general). For that matter, I still haven't explained why Constant is useful. I'll admit, it was added a lot later than the other combinators. We'll get to it, though.</p>
<svg viewBox='0 0 850 270'>
  <g font-size='20px' text-anchor='middle' transform='translate(145,20)'>
    <rect class='code' stroke-width='1' rx='12' x='-120.4' y='1' width='240.8' height='205'/>
    <text dy='0.32em' y='223' fill='currentColor'>Atop</text>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(-60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L0 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 57L0 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='0' y='57'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='0' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Value'>𝕨</tspan> <tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L0 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 57L-32 114'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 57L32 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='114'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='0' y='57'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='-32' y='114'><tspan class='Value'>𝕨</tspan></text>
      <text dy='0.32em' x='32' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
  </g>
  <g font-size='20px' text-anchor='middle' transform='translate(425,20)'>
    <rect class='code' stroke-width='1' rx='12' x='-120.4' y='1' width='240.8' height='205'/>
    <text dy='0.32em' y='223' fill='currentColor'>Self/Swap</text>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(-60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Function'>𝔽</tspan><tspan class='Modifier'>˜</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0Q-41.6 57 0 114'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0Q41.6 57 0 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='0' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Value'>𝕨</tspan> <tspan class='Function'>𝔽</tspan><tspan class='Modifier'>˜</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0C-40 28.5 0 57 32 114'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0C40 28.5 0 57 -32 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='114'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='-32' y='114'><tspan class='Value'>𝕨</tspan></text>
      <text dy='0.32em' x='32' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
  </g>
  <g font-size='20px' text-anchor='middle' transform='translate(705,20)'>
    <rect class='code' stroke-width='1' rx='12' x='-120.4' y='1' width='240.8' height='205'/>
    <text dy='0.32em' y='223' fill='currentColor'>Constant</text>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(-60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Value'>𝕗</tspan><tspan class='Modifier'>˙</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L0 57'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='114'/>
      <text dy='0.32em' x='0' y='57'><tspan class='Value'>𝕗</tspan></text>
      <text dy='0.32em' x='0' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Value'>𝕨</tspan> <tspan class='Value'>𝕗</tspan><tspan class='Modifier'>˙</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L0 57'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='114'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='114'/>
      <text dy='0.32em' x='0' y='57'><tspan class='Value'>𝕗</tspan></text>
      <text dy='0.32em' x='-32' y='114'><tspan class='Value'>𝕨</tspan></text>
      <text dy='0.32em' x='32' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
  </g>
</svg>

<h2 id="comparisons"><a class="header" href="#comparisons">Comparisons</a></h2>
<table class='primitives'>
  <tr>
    <td><span class='Function'><</span></td>
    <td></td>
    <td></td>
    <td>Less Than</td>
  </tr>
  <tr>
    <td><span class='Function'>></span></td>
    <td></td>
    <td></td>
    <td>Greater Than</td>
  </tr>
  <tr>
    <td><span class='Function'></span></td>
    <td><kbd>\/</kbd></td>
    <td>Length</td>
    <td>Not Equals</td>
  </tr>
  <tr>
    <td><span class='Function'>=</span></td>
    <td></td>
    <td>Rank</td>
    <td>Equals</td>
  </tr>
  <tr>
    <td><span class='Function'></span></td>
    <td><kbd>\<</kbd></td>
    <td></td>
    <td>Less Than or Equal to</td>
  </tr>
  <tr>
    <td><span class='Function'></span></td>
    <td><kbd>\></kbd></td>
    <td></td>
    <td>Greater Than or Equal to</td>
  </tr>
</table>

<p>Before we go further, let's introduce some new functions that we might like to use with combinators. BQN includes the full mathematical suite of <a href="https://en.wikipedia.org/wiki/Inequality_(mathematics)">comparisons</a>, with their standard widely-known Unicode symbols. It's surprising how much having the proper symbols instead of digraphs like <code><span class='Function'>!=</span></code> or <code><span class='Function'>&gt;=</span></code> improves readability!</p>
<p>The comparisons are functions like any other—specifically, they are all two-argument functions, and the same symbol with only one argument might mean something else. Given two numbers or characters, they return <code><span class='Number'>1</span></code> if these arguments compare in the specified way and <code><span class='Number'>0</span></code> if they don't: for example, <code><span class='Function'>&lt;</span></code> returns <code><span class='Number'>1</span></code> when the left argument is strictly less than the right and <code><span class='Function'>&gt;</span></code> returns <code><span class='Number'>1</span></code> if the right is strictly less than the left. Characters are always considered to be greater than numbers, as though a larger &quot;characterness&quot; counts for more than any number.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MyA8IDQKNCA+IOKIngriiJ4gPCBA">↗️</a><pre>    <span class='Number'>3</span> <span class='Function'>&lt;</span> <span class='Number'>4</span>
1
    <span class='Number'>4</span> <span class='Function'>&gt;</span> <span class='Number'></span>
0
    <span class='Number'></span> <span class='Function'>&lt;</span> <span class='String'>@</span>
1
</pre>
<h3 id="booleans"><a class="header" href="#booleans">Booleans</a></h3>
<p>The return values <code><span class='Number'>0</span></code> and <code><span class='Number'>1</span></code> are natural choices because BQN has no dedicated boolean type: instead, in BQN, the word <em>boolean</em> indicates a number that's 0 or 1, much like &quot;natural number&quot; selects a subset of the possible numbers. This is a choice that might be at odds with your own programming experience, and especially clashes with the world of typed functional programming, where even using the boolean type rather than a dedicated type for an option might be considered a code smell! The design principle guiding this decision, and most of BQN's type system, is that there should only be one type that accomplishes any given programming task. Any distinctions that it has are there because they are really necessary: conflating numbers and characters would make working with strings too difficult, and functions can't really be combined with modifiers because one-argument functions and 1-modifiers take their inputs on different sides.</p>
<p>The advantage of this strategy is that you will spend much less time thinking about types when writing programs. The decisions are already made: if there are a few things, they go in a list; if there a few possible values in a qualitative category then they should be labelled with numbers. And if some value has multiple interpretations then BQN is less likely to require an explicit conversion between these. For example, while the result of <code><span class='Function'>=</span></code> might be taking to say <em>whether</em> two atoms have equal values, maybe it also says <em>how many times</em> the atom on the left appears in the right argument—which is at most one, because there's only one right argument. A silly distinction, or is it? An important property of counts is that we can add them together, for instance, to find how many times the letter &quot;e&quot; appears in a string.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=J2UnID0gIkdlb3JnZSBCb29sZSIKCivCtCAnZScgPSAiR2VvcmdlIEJvb2xlIgoKJ2UnICvCtOKImD0gIkdlb3JnZSBCb29sZSIgICMgV2l0aCBhIGNvbWJpbmF0b3I=">↗️</a><pre>    <span class='String'>'e'</span> <span class='Function'>=</span> <span class='String'>&quot;George Boole&quot;</span>
⟨ 0 1 0 0 0 1 0 0 0 0 0 1 ⟩

    <span class='Function'>+</span><span class='Modifier'>´</span> <span class='String'>'e'</span> <span class='Function'>=</span> <span class='String'>&quot;George Boole&quot;</span>
3

    <span class='String'>'e'</span> <span class='Function'>+</span><span class='Modifier'>´</span><span class='Modifier2'></span><span class='Function'>=</span> <span class='String'>&quot;George Boole&quot;</span>  <span class='Comment'># With a combinator
</span>3
</pre>
<p>This, a well-typed and well-spoken programmer should declare, is an outrage! The purpose of types is to <em>protect</em> us from applying functions to types they're not intended for, because the most likely result is that such an application doesn't make sense. Static types provide a valuable service by catching these dangerous actions at compile time and allowing a programmer to prove that they never happen. Well… this is all true. BQN chooses not to pay the type price of this service and so doesn't get the type protection. And it helps that it's consistent about this choice, so you know that BQN's types are never the answer to these sorts of safety concerns. You will have to find a different way to avoid type errors: perhaps just programming carefully in a small or one-off program, and testing and code review or even external tools in a large one. All that said, I think programmers from outside the array programming world (and even many inside!) drastically underestimate how often a boolean value is really just a narrow-minded take on a counting number.</p>
<h3 id="comparing-whole-arrays"><a class="header" href="#comparing-whole-arrays">Comparing whole arrays</a></h3>
<table class='primitives'>
  <tr>
    <td><span class='Function'></span></td>
    <td><kbd>\m</kbd></td>
    <td>Depth</td>
    <td>Match</td>
  </tr>
  <tr>
    <td><span class='Function'></span></td>
    <td><kbd>\M</kbd></td>
    <td></td>
    <td>Not Match</td>
  </tr>
</table>

<p>Programmers not as inclined to grandiose philosophical discursions will note from the example above that <code><span class='Function'>=</span></code> is a pervasive function, like arithmetic functions such as <code><span class='Function'>+</span></code> and <code><span class='Function'></span></code>. This can be useful, as that example shows, but it's difficult to use <code><span class='Function'>=</span></code> to check whether, for example, two lists are the same. For equal-length lists we might compare element-wise and then multiply the results together (giving <code><span class='Number'>0</span></code> if the resulting list contained a <code><span class='Number'>0</span></code>):</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=ImFiY2QiIMOXwrTiiJg9ICJhYmRkIg==">↗️</a><pre>    <span class='String'>&quot;abcd&quot;</span> <span class='Function'>×</span><span class='Modifier'>´</span><span class='Modifier2'></span><span class='Function'>=</span> <span class='String'>&quot;abdd&quot;</span>
0
</pre>
<p>For arbitrary values it's harder: we need to know whether the arguments are atoms or lists, and whether they have the same length, and what happens if some of their <em>elements</em> are lists? To avoid all this trouble, the function Match (<code><span class='Function'></span></code>) tests whether its arguments are identical, returning <code><span class='Number'>1</span></code> if they are and <code><span class='Number'>0</span></code> if they aren't—always an atomic return value and never a list.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=ImFiY2QiIOKJoSAiYWJkZCIKImFiYyLigL8iZGUiIOKJoSAiYWJjIuKAvyJkZSI=">↗️</a><pre>    <span class='String'>&quot;abcd&quot;</span> <span class='Function'></span> <span class='String'>&quot;abdd&quot;</span>
0
    <span class='String'>&quot;abc&quot;</span><span class='Ligature'></span><span class='String'>&quot;de&quot;</span> <span class='Function'></span> <span class='String'>&quot;abc&quot;</span><span class='Ligature'></span><span class='String'>&quot;de&quot;</span>
1
</pre>
<p>In analogy with Not Equals (<code><span class='Function'></span></code>) testing whether two atoms are different, Not Match (<code><span class='Function'></span></code>) tests whether two arbitrary values differ.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MuKAvzPigL804oC/MiDiiaAgM+KAvzPigL8y4oC/Mgoy4oC/M+KAvzTigL8yIOKJoiAz4oC/M+KAvzLigL8y">↗️</a><pre>    <span class='Number'>2</span><span class='Ligature'></span><span class='Number'>3</span><span class='Ligature'></span><span class='Number'>4</span><span class='Ligature'></span><span class='Number'>2</span> <span class='Function'></span> <span class='Number'>3</span><span class='Ligature'></span><span class='Number'>3</span><span class='Ligature'></span><span class='Number'>2</span><span class='Ligature'></span><span class='Number'>2</span>
⟨ 1 0 1 0 ⟩
    <span class='Number'>2</span><span class='Ligature'></span><span class='Number'>3</span><span class='Ligature'></span><span class='Number'>4</span><span class='Ligature'></span><span class='Number'>2</span> <span class='Function'></span> <span class='Number'>3</span><span class='Ligature'></span><span class='Number'>3</span><span class='Ligature'></span><span class='Number'>2</span><span class='Ligature'></span><span class='Number'>2</span>
1
</pre>
<h2 id="length-rank-and-depth"><a class="header" href="#length-rank-and-depth">Length, rank, and depth</a></h2>
<p>I said above that the comparison functions might have a different meaning when called with only one argument, so let's cover a few of these.</p>
<p>Length (<code><span class='Function'></span></code>) gives the number of elements in a list. For atoms it returns 1; it can't result in an error.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4omgICJ0ZXN0aW5nIgriiaAg4p+o4p+pCuKJoCDin6ggz4AsIOKImCwgImVsZW1lbnQiIOKLhCDin6gnbCcsMSw1LCd0J+KfqSDin6kK4omgIDQ=">↗️</a><pre>    <span class='Function'></span> <span class='String'>&quot;testing&quot;</span>
7
    <span class='Function'></span> <span class='Bracket'>⟨⟩</span>
0
    <span class='Function'></span> <span class='Bracket'></span> <span class='Number'>π</span><span class='Separator'>,</span> <span class='Modifier2'></span><span class='Separator'>,</span> <span class='String'>&quot;element&quot;</span> <span class='Separator'></span> <span class='Bracket'></span><span class='String'>'l'</span><span class='Separator'>,</span><span class='Number'>1</span><span class='Separator'>,</span><span class='Number'>5</span><span class='Separator'>,</span><span class='String'>'t'</span><span class='Bracket'></span> <span class='Bracket'></span>
4
    <span class='Function'></span> <span class='Number'>4</span>
1
</pre>
<p>Rank (<code><span class='Function'>=</span></code>) returns <code><span class='Number'>0</span></code> when called on an atom and <code><span class='Number'>1</span></code> when called on a list. I'm <strong>absolutely sure</strong> this boolean result is not just a narrow-minded take on a counting number. But don't assume that every value with rank 0 is an atom.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=PSAwLjUKPSDihpUzCj0gJ2EnCj0gImEi">↗️</a><pre>    <span class='Function'>=</span> <span class='Number'>0.5</span>
0
    <span class='Function'>=</span> <span class='Function'></span><span class='Number'>3</span>
1
    <span class='Function'>=</span> <span class='String'>'a'</span>
0
    <span class='Function'>=</span> <span class='String'>&quot;a&quot;</span>
1
</pre>
<p>Depth (<code><span class='Function'></span></code>) gives the recursive nesting depth of its argument: the greatest number of times you can take an element before reaching an atom. That is, for an atom, it's 0, but for a list, it's one more than the highest depth of any element.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4omhICJkcmVhbSIgICAgICAgICAgICAgICAgICAjIEFuIG9yZGluYXJ5IGRyZWFtCuKJoSAiZCLigL8iciLigL8iZSLigL8iYSLigL8ibSIgICAgICAjIFdoYXQgaWYgdGhlIGxldHRlcnMgd2VyZSBzdHJpbmdzPwriiaEg4p+oICJkIuKAvyJyIuKAvyJlIuKAvyJhIuKAvyJtIiDin6kgICMgV2UgaGF2ZSB0byBnbyBkZWVwZXI=">↗️</a><pre>    <span class='Function'></span> <span class='String'>&quot;dream&quot;</span>                  <span class='Comment'># An ordinary dream
</span>1
    <span class='Function'></span> <span class='String'>&quot;d&quot;</span><span class='Ligature'></span><span class='String'>&quot;r&quot;</span><span class='Ligature'></span><span class='String'>&quot;e&quot;</span><span class='Ligature'></span><span class='String'>&quot;a&quot;</span><span class='Ligature'></span><span class='String'>&quot;m&quot;</span>      <span class='Comment'># What if the letters were strings?
</span>2
    <span class='Function'></span> <span class='Bracket'></span> <span class='String'>&quot;d&quot;</span><span class='Ligature'></span><span class='String'>&quot;r&quot;</span><span class='Ligature'></span><span class='String'>&quot;e&quot;</span><span class='Ligature'></span><span class='String'>&quot;a&quot;</span><span class='Ligature'></span><span class='String'>&quot;m&quot;</span> <span class='Bracket'></span>  <span class='Comment'># We have to go deeper
</span>3
</pre>
<p>You probably won't end up using Depth too much. The data in a typical program has a fixed, known depth, so there's no point in asking BQN what it is. But it might be useful if you want to write a utility function that's flexible about its input. <code><span class='Number'>0</span><span class='Function'>&lt;</span><span class='Value'>a</span></code> is the idiomatic way to test whether <code><span class='Value'>a</span></code> is an array.</p>
<h2 id="composition"><a class="header" href="#composition">Composition</a></h2>
<p>We've discussed Atop (<code><span class='Modifier2'></span></code>), but hopefully you've intuited that it's not the end of the story as far as compositions go. In fact BQN has <strong>three</strong> more modifiers that could reasonably be interpreted as varieties of composition.</p>
<h3 id="over"><a class="header" href="#over">Over</a></h3>
<table class='primitives'>
  <tr>
    <td><span class='Modifier2'></span></td>
    <td><kbd>\k</kbd></td>
    <td colspan='2'>Over</td>
  </tr>
</table>

<p>Let's start by returning to a computation mentioned when we introduced Match (<code><span class='Function'></span></code>), that of testing whether two arrays have the same length.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=KOKJoCJzdHJpbmciKSA9IOKJoCJzdGluZyI=">↗️</a><pre>    <span class='Paren'>(</span><span class='Function'></span><span class='String'>&quot;string&quot;</span><span class='Paren'>)</span> <span class='Function'>=</span> <span class='Function'></span><span class='String'>&quot;sting&quot;</span>
0
</pre>
<p>This code, to a BQN programmer, should look offensive. The exact same function is called twice, even though an English description only mentions it once. Not to mention that the call on the left is far away from the rest of the expression and requires an extra set of parentheses. It's possible to factor out the repeated <code><span class='Function'></span></code> using Each and Reduce, but now the code is harder to read:</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=PcK04omgwqgg4p+oInN0cmluZyIsInN0aW5nIuKfqQ==">↗️</a><pre>    <span class='Function'>=</span><span class='Modifier'>´</span><span class='Function'></span><span class='Modifier'>¨</span> <span class='Bracket'></span><span class='String'>&quot;string&quot;</span><span class='Separator'>,</span><span class='String'>&quot;sting&quot;</span><span class='Bracket'></span>
0
</pre>
<p>This is a very common pattern, and a sensible language should have a better way to handle it! BQN does, in the form of a 2-modifier called Over.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=InN0cmluZyIgPeKXi+KJoCAic3Rpbmci">↗️</a><pre>    <span class='String'>&quot;string&quot;</span> <span class='Function'>=</span><span class='Modifier2'></span><span class='Function'></span> <span class='String'>&quot;sting&quot;</span>
0
</pre>
<p>Let's use the list formation function Solo/Couple (<code><span class='Function'></span></code>) to see what happens more clearly:</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=InN0cmluZyIg4omN4peL4omgICJzdGluZyIK4omN4peL4omgICJzdGluZyI=">↗️</a><pre>    <span class='String'>&quot;string&quot;</span> <span class='Function'></span><span class='Modifier2'></span><span class='Function'></span> <span class='String'>&quot;sting&quot;</span>
⟨ 6 5 ⟩
    <span class='Function'></span><span class='Modifier2'></span><span class='Function'></span> <span class='String'>&quot;sting&quot;</span>
⟨ 5 ⟩
</pre>
<p>Atop always applies its right operand once, passing every argument (that is, one or two of them) in that call. Over calls its right operand on each argument individually. The results are then all used as arguments to the left operand. If there's only one argument, Atop and Over turn out to be the same: both of them call the right operand, then the left, like ordinary mathematical composition. Here are the two together for comparison.</p>
<svg viewBox='-51 0 672 270'>
  <g font-size='20px' text-anchor='middle' transform='translate(145,20)'>
    <rect class='code' stroke-width='1' rx='12' x='-120.4' y='1' width='240.8' height='205'/>
    <text dy='0.32em' y='223' fill='currentColor'>Atop</text>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(-60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L0 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 57L0 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='0' y='57'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='0' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Value'>𝕨</tspan> <tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L0 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 57L-32 114'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 57L32 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='114'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='0' y='57'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='-32' y='114'><tspan class='Value'>𝕨</tspan></text>
      <text dy='0.32em' x='32' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
  </g>
  <g font-size='20px' text-anchor='middle' transform='translate(425,20)'>
    <rect class='code' stroke-width='1' rx='12' x='-120.4' y='1' width='240.8' height='205'/>
    <text dy='0.32em' y='223' fill='currentColor'>Over</text>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(-60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L0 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 57L0 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='0' y='57'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='0' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Value'>𝕨</tspan> <tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L-32 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M-32 57L-32 114'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L32 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M32 57L32 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='114'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='-32' y='57'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='32' y='57'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='-32' y='114'><tspan class='Value'>𝕨</tspan></text>
      <text dy='0.32em' x='32' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
  </g>
</svg>

<h3 id="before-and-after"><a class="header" href="#before-and-after">Before and After</a></h3>
<p>Atop (<code><span class='Modifier2'></span></code>) and Over (<code><span class='Modifier2'></span></code>) are both symmetric in some sense: with two arguments, <code><span class='Paren'>(</span><span class='Function'>F</span><span class='Modifier2'></span><span class='Function'>G</span><span class='Paren'>)</span><span class='Modifier'>˜</span></code> is <code><span class='Function'>F</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Function'>G</span><span class='Modifier'>˜</span><span class='Paren'>)</span></code>, and <code><span class='Paren'>(</span><span class='Function'>F</span><span class='Modifier2'></span><span class='Function'>G</span><span class='Paren'>)</span><span class='Modifier'>˜</span></code> is <code><span class='Paren'>(</span><span class='Function'>F</span><span class='Modifier'>˜</span><span class='Paren'>)</span><span class='Modifier2'></span><span class='Function'>G</span></code>. Put another way, reversing the order of arguments to Atop or Over as a whole is the same as reversing the order of every two-argument function inside—<code><span class='Function'>G</span></code> for <code><span class='Function'>F</span><span class='Modifier2'></span><span class='Function'>G</span></code> and <code><span class='Function'>F</span></code> for <code><span class='Function'>F</span><span class='Modifier2'></span><span class='Function'>G</span></code>. If it's not obvious why this is the case, work it out for yourself by walking through how these functions would apply to their arguments! This causes their diagrams to be symmetric as well. Swap (<code><span class='Modifier'>˜</span></code>) also has a symmetric diagram, and it's very easy to show that it's symmetric: take a look at <code><span class='Paren'>(</span><span class='Function'>F</span><span class='Modifier'>˜</span><span class='Paren'>)</span><span class='Modifier'>˜</span></code> and <code><span class='Paren'>(</span><span class='Function'>F</span><span class='Modifier'>˜</span><span class='Paren'>)</span><span class='Modifier'>˜</span></code>. In both cases I started with <code><span class='Function'>F</span><span class='Modifier'>˜</span></code>, but in one case I applied <code><span class='Modifier'>˜</span></code> to the entire function and in the other I applied it on the inside, to <code><span class='Function'>F</span></code> only. And I won't tell you which is which.</p>
<table class='primitives'>
  <tr>
    <td><span class='Modifier2'></span></td>
    <td><kbd>\h</kbd></td>
    <td colspan='2'>Before/Bind</td>
  </tr>
  <tr>
    <td><span class='Modifier2'></span></td>
    <td><kbd>\l</kbd></td>
    <td colspan='2'>After/Bind</td>
  </tr>
</table>

<p>Sometimes we'd like to handle the arguments differently, so BQN has a pair of 2-modifiers to apply a function to one argument only: Before (<code><span class='Modifier2'></span></code>) and After (<code><span class='Modifier2'></span></code>). Each is written with a circle for composition (remember, every 2-modifier has a circle in it!), with a line pointing to the function that takes only one argument. Here's how that works with some example functions and arguments.</p>
<table>
<thead>
<tr>
<th>After</th>
<th>Before</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><span class='Number'>2</span> <span class='Function'></span><span class='Modifier2'></span><span class='Function'>-</span> <span class='Number'>3</span></code></td>
<td><code><span class='Number'>2</span>  <span class='Function'></span><span class='Modifier2'></span><span class='Function'>-</span>  <span class='Number'>3</span></code></td>
</tr>
<tr>
<td><code><span class='Number'>2</span> <span class='Function'></span> <span class='Function'>-</span> <span class='Number'>3</span></code></td>
<td><code><span class='Paren'>(</span><span class='Function'></span> <span class='Number'>2</span><span class='Paren'>)</span> <span class='Function'>-</span> <span class='Number'>3</span></code></td>
</tr>
</tbody>
</table>
<p>The order of application matches the way the two modifiers' names are pronounced in English. <code><span class='Function'></span><span class='Modifier2'></span><span class='Function'>-</span></code> is &quot;Power After Negation&quot;, so that it negates <code><span class='Number'>3</span></code> first, then raises <code><span class='Number'>2</span></code> to that power. <code><span class='Function'></span><span class='Modifier2'></span><span class='Function'>-</span></code> is &quot;Exponent Before Subtracting&quot;, so it takes the natural exponent of <code><span class='Number'>2</span></code> first, and then subtracts <code><span class='Number'>3</span></code>. After doesn't need parentheses when it's expanded to a full phrase, so you might think of it as the more &quot;natural&quot; of the two.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MiDii4bin5wtIDMKMiDii4biirgtIDM=">↗️</a><pre>    <span class='Number'>2</span> <span class='Function'></span><span class='Modifier2'></span><span class='Function'>-</span> <span class='Number'>3</span>
0.125
    <span class='Number'>2</span> <span class='Function'></span><span class='Modifier2'></span><span class='Function'>-</span> <span class='Number'>3</span>
4.38905609893065
</pre>
<p>Despite this, I tend to use <code><span class='Modifier2'></span></code> a little more than <code><span class='Modifier2'></span></code>. As one example, remember that Rotate (<code><span class='Function'></span></code>) rotates its right argument to the left by an amount given by the left argument. But a negative left argument goes in the opposite direction, so <code><span class='Function'>-</span><span class='Modifier2'></span><span class='Function'></span></code> is a compact way to write the &quot;opposite rotate&quot;.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=NCAt4oq44oy9ICIgYmVmb3JlIiAgIyBSb3RhdGUgdG8gdGhlIHJpZ2h0IGJ5IGZvdXIKNCDijL3igbwgICIgYmVmb3JlIiAgIyBPa2F5IHRoaXMgdGltZSBVbmRvIGlzIGJldHRlcg==">↗️</a><pre>    <span class='Number'>4</span> <span class='Function'>-</span><span class='Modifier2'></span><span class='Function'></span> <span class='String'>&quot; before&quot;</span>  <span class='Comment'># Rotate to the right by four
</span>"fore be"
    <span class='Number'>4</span> <span class='Function'></span><span class='Modifier'></span>  <span class='String'>&quot; before&quot;</span>  <span class='Comment'># Okay this time Undo is better
</span>"fore be"
</pre>
<p>Here are the diagrams for Before and After: as promised, they're not symmetrical. The function on the circle side of the symbol always goes on top, since it's the one that takes two arguments. If you find these diagrams to be a helpful way to visualize things, you might picture picking up the expression at the ring to drag that function up and away from the rest of the expression.</p>
<svg viewBox='-51 0 672 270'>
  <g font-size='20px' text-anchor='middle' transform='translate(145,20)'>
    <rect class='code' stroke-width='1' rx='12' x='-120.4' y='1' width='240.8' height='205'/>
    <text dy='0.32em' y='223' fill='currentColor'>Before</text>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(-60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L-32 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M-32 57L0 114'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0Q41.6 57 0 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='-32' y='57'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='0' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Value'>𝕨</tspan> <tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L-32 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M-32 57L-32 114'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0C40 57 32 51.3 32 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='114'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='-32' y='57'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='-32' y='114'><tspan class='Value'>𝕨</tspan></text>
      <text dy='0.32em' x='32' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
  </g>
  <g font-size='20px' text-anchor='middle' transform='translate(425,20)'>
    <rect class='code' stroke-width='1' rx='12' x='-120.4' y='1' width='240.8' height='205'/>
    <text dy='0.32em' y='223' fill='currentColor'>After</text>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(-60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0Q-41.6 57 0 114'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L32 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M32 57L0 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='32' y='57'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='0' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Value'>𝕨</tspan> <tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0C-40 57 -32 51.3 -32 114'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L32 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M32 57L32 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='114'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='32' y='57'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='-32' y='114'><tspan class='Value'>𝕨</tspan></text>
      <text dy='0.32em' x='32' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
  </g>
</svg>

<p>What about the one-argument case? The structure of application is exactly the same, except that there's only one argument available, so it's used in both input positions. If I describe it that way, it sounds like lazy design, but the ability to use one argument in two ways makes the one-argument versions of Before and After even more useful than the two-argument ones. For example, consider the function <code><span class='Value'>y</span> <span class='Function'>=</span> <span class='Value'>x</span><span class='Function'>×</span><span class='Paren'>(</span><span class='Number'>1</span><span class='Function'>-</span><span class='Value'>x</span><span class='Paren'>)</span></code>, which gives a parabola that's equal to 0 at 0 and 1, and peaks between them when x is 0.5. The function Not (<code><span class='Function'>¬</span></code>, which we'll discuss in a later tutorial) is defined so that <code><span class='Function'>¬</span><span class='Value'>x</span></code> is <code><span class='Number'>1</span><span class='Function'>-</span><span class='Value'>x</span></code>, which conveniently allows us to write this function as either <code><span class='Function'>¬</span><span class='Modifier2'></span><span class='Function'>×</span></code> or <code><span class='Function'>×</span><span class='Modifier2'></span><span class='Function'>¬</span></code>.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=wqziirjDlyAwLjU=">↗️</a><pre>    <span class='Function'>¬</span><span class='Modifier2'></span><span class='Function'>×</span> <span class='Number'>0.5</span>
0.25
</pre>
<p>What if we want to call it on eight equally-spaced numbers between 0 and 1? Well, <code><span class='Function'></span><span class='Number'>8</span></code> gives us eight equally-spaced numbers, but to rescale them we'd want to divide by <code><span class='Number'>8</span></code>. That's <code><span class='Paren'>(</span><span class='Function'></span><span class='Number'>8</span><span class='Paren'>)</span><span class='Function'>÷</span><span class='Number'>8</span></code>, but it's nicer to use Before again.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oaV4oq4w7cgOAoKwqziirjDlyDihpXiirjDtyA4">↗️</a><pre>    <span class='Function'></span><span class='Modifier2'></span><span class='Function'>÷</span> <span class='Number'>8</span>
⟨ 0 0.125 0.25 0.375 0.5 0.625 0.75 0.875 ⟩

    <span class='Function'>¬</span><span class='Modifier2'></span><span class='Function'>×</span> <span class='Function'></span><span class='Modifier2'></span><span class='Function'>÷</span> <span class='Number'>8</span>
⟨ 0 0.109375 0.1875 0.234375 0.25 0.234375 0.1875 0.109375 ⟩
</pre>
<p>Our list of arguments stops before reaching 1, because <code><span class='Function'></span><span class='Number'>8</span></code> doesn't include <code><span class='Number'>8</span></code>. If we wanted a list from 0 to 1 <em>inclusive</em>, we'd need to divide by <code><span class='Number'>7</span></code> (that is, <code><span class='Number'>8</span><span class='Function'>-</span><span class='Number'>1</span></code>) instead of <code><span class='Number'>8</span></code>. We can do this as well! But first we need to understand some other ways to apply Before and After.</p>
<h4 id="bind"><a class="header" href="#bind">Bind</a></h4>
<p>We showed in the first tutorial that a modifier's operand doesn't have to be a function, but can also be a data value. That hasn't come up yet, except for a cryptic use of &quot;Bind&quot; (<code><span class='Modifier2'></span></code>?) in the function <code><span class='Paren'>(</span><span class='Function'></span><span class='Number'>2</span><span class='Function'>⋆↕</span><span class='Number'>8</span><span class='Paren'>)</span><span class='Modifier2'></span><span class='Function'>×</span><span class='Modifier'>¨</span></code> from the last tutorial. How does that work? Some kind of secret identity for Before and After?</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MeKKuCsgNQor4p+cMSA1">↗️</a><pre>    <span class='Number'>1</span><span class='Modifier2'></span><span class='Function'>+</span> <span class='Number'>5</span>
6
    <span class='Function'>+</span><span class='Modifier2'></span><span class='Number'>1</span> <span class='Number'>5</span>
6
</pre>
<p>Nope, just the regular identity, plus the fact that BQN allows data values to be applied as functions. Specifically, <em>constant</em> functions, that ignore the arguments and just return themselves. For a simpler example, let's use <code><span class='Modifier'>˜</span></code> (but remember that BQN has a dedicated constant modifier <code><span class='Modifier'>˙</span></code> which is better to use if you're trying to define a constant function since it will also work on function or modifier operands).</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=ImNvbnN0IsucIDUKQCAiY29uc3Qiy5wgNg==">↗️</a><pre>    <span class='String'>&quot;const&quot;</span><span class='Modifier'>˜</span> <span class='Number'>5</span>
"const"
    <span class='String'>@</span> <span class='String'>&quot;const&quot;</span><span class='Modifier'>˜</span> <span class='Number'>6</span>
"const"
</pre>
<p>The modifier <code><span class='Modifier'>˜</span></code> applies its operand function to the arguments, after swapping them around or whatever. In this case, the operand function is a data type (not a function or modifier), so it ignores those arguments! Our &quot;Bind&quot; modifiers work the same way: for example, <code><span class='Number'>1</span><span class='Modifier2'></span><span class='Function'>+</span> <span class='Number'>5</span></code> is <code><span class='Paren'>(</span><span class='Number'>1</span> <span class='Number'>5</span><span class='Paren'>)</span><span class='Function'>+</span><span class='Number'>5</span></code>, or it would be if <code><span class='Number'>1</span></code> were a function. Applying <code><span class='Number'>1</span></code> to <code><span class='Number'>5</span></code> gives <code><span class='Number'>1</span></code>, so the final result is <code><span class='Number'>1</span><span class='Function'>+</span><span class='Number'>5</span></code> or <code><span class='Number'>6</span></code>.</p>
<p>To use Bind, you have to remember that the line points towards the constant value. Otherwise the constant will be applied last, and it'll return itself as the final result regardless of what you did before.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=K+KKuDEgNQ==">↗️</a><pre>    <span class='Function'>+</span><span class='Modifier2'></span><span class='Number'>1</span> <span class='Number'>5</span>
1
</pre>
<p>Here's another way to look at splitting up an expression with Bind: to split up <code><span class='Number'>2</span><span class='Function'></span><span class='Number'>5</span></code> we can either Bind 2 Before Power, or Bind 5 After Power. Which one to use depends on the situation.</p>
<table>
<thead>
<tr>
<th>Before</th>
<th></th>
<th>After</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><span class='Number'>2</span><span class='Modifier2'></span><span class='Function'></span> <span class='Number'>5</span></code></td>
<td><code><span class='Number'>2</span> <span class='Function'></span> <span class='Number'>5</span></code></td>
<td><code><span class='Function'></span><span class='Modifier2'></span><span class='Number'>5</span> <span class='Number'>2</span></code></td>
</tr>
</tbody>
</table>
<p>Back to our unsatisfactory list of numbers. We have the first, but we want the second.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oaV4oq4w7cgOAoo4oaVOCkgw7cgNw==">↗️</a><pre>    <span class='Function'></span><span class='Modifier2'></span><span class='Function'>÷</span> <span class='Number'>8</span>
⟨ 0 0.125 0.25 0.375 0.5 0.625 0.75 0.875 ⟩
    <span class='Paren'>(</span><span class='Function'></span><span class='Number'>8</span><span class='Paren'>)</span> <span class='Function'>÷</span> <span class='Number'>7</span>
⟨ 0 0.1428571428571428 0.2857142857142857 0.4285714285714285 0.5714285714285714 0.7142857142857143 0.8571428571428571 1 ⟩
</pre>
<p>What function turns 8 into 7? We can bind <code><span class='Number'>1</span></code> to <code><span class='Function'>-</span></code> on the left:</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=LeKfnDEgOA==">↗️</a><pre>    <span class='Function'>-</span><span class='Modifier2'></span><span class='Number'>1</span> <span class='Number'>8</span>
7
</pre>
<p>Now we need to apply <code><span class='Function'></span></code> <em>and</em> this function to <code><span class='Number'>8</span></code>, dividing the results. It turns out we can do this using both Before and After. On one side we'll have <code><span class='Function'></span><span class='Number'>8</span></code>, and on the other <code><span class='Function'>-</span><span class='Modifier2'></span><span class='Number'>1</span> <span class='Number'>8</span></code>.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oaV4oq4w7fin5woLeKfnDEpIDg=">↗️</a><pre>    <span class='Function'></span><span class='Modifier2'></span><span class='Function'>÷</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Function'>-</span><span class='Modifier2'></span><span class='Number'>1</span><span class='Paren'>)</span> <span class='Number'>8</span>
⟨ 0 0.1428571428571428 0.2857142857142857 0.4285714285714285 0.5714285714285714 0.7142857142857143 0.8571428571428571 1 ⟩
</pre>
<p>This structure—Before on the left, After on the right—is also useful with two arguments: I call it &quot;split compose&quot;, and it applies one function to the left argument and another to the right before passing them both to the middle function (if the functions on both sides are the same, that would be Over!). Although it turns out it's not needed in the one-argument case. You'll get the same result just by jamming the functions together. This is called a &quot;train&quot; and we should probably leave it for another tutorial before going too far off the rails.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=KOKGlcO3LeKfnDEpIDg=">↗️</a><pre>    <span class='Paren'>(</span><span class='Function'>↕÷-</span><span class='Modifier2'></span><span class='Number'>1</span><span class='Paren'>)</span> <span class='Number'>8</span>
⟨ 0 0.1428571428571428 0.2857142857142857 0.4285714285714285 0.5714285714285714 0.7142857142857143 0.8571428571428571 1 ⟩
</pre>
<h2 id="base-decoding-continued"><a class="header" href="#base-decoding-continued">Base decoding continued</a></h2>
<p>We're speeding up a bit now, so in the examples below it might take some time for you to break down what I did and why. Remember that you can open any expression in the REPL in order to change parts of it or view the syntax. And don't get discouraged just because of how long it takes to understand a line of code! First, you'll surely get faster in fitting the pieces together. Second, a line of BQN often has more code in it than a line in other languages, because primitives have such short names. Think about how much <em>functionality</em> you can read and understand rather than how few <em>lines</em> you get through.</p>
<p>In the last tutorial I <a href="list.html#example-base-decoding">went over</a> a way to decode a list of strings containing binary codes for ASCII characters:</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=QCArICvCtMKoICjijL0y4ouG4oaVOCniirjDl8KoICcwJyAty5wgIjAxMDAwMDEwIuKAvyIwMTAxMDAwMSLigL8iMDEwMDExMTAi">↗️</a><pre>    <span class='String'>@</span> <span class='Function'>+</span> <span class='Function'>+</span><span class='Modifier'>´¨</span> <span class='Paren'>(</span><span class='Function'></span><span class='Number'>2</span><span class='Function'>⋆↕</span><span class='Number'>8</span><span class='Paren'>)</span><span class='Modifier2'></span><span class='Function'>×</span><span class='Modifier'>¨</span> <span class='String'>'0'</span> <span class='Function'>-</span><span class='Modifier'>˜</span> <span class='String'>&quot;01000010&quot;</span><span class='Ligature'></span><span class='String'>&quot;01010001&quot;</span><span class='Ligature'></span><span class='String'>&quot;01001110&quot;</span>
"BQN"
</pre>
<p>Now that we know our combinators, we can do a bit more work on this code. First, we can rather mechanically turn it into a standalone function (fit to be passed as an operand, or given a name, if we knew how to give things names). Just bind each left argument to the corresponding function, and then join all the functions with <code><span class='Modifier2'></span></code>.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=QOKKuCsgK8K0wqggKOKMvTLii4bihpU4KeKKuMOXwqggLeKfnCcwJyAiMDEwMDAwMTAi4oC/IjAxMDEwMDAxIuKAvyIwMTAwMTExMCIKCihA4oq4KyniiJgoK8K0wqgp4oiYKCjijL0y4ouG4oaVOCniirjDl8KoKeKImCgt4p+cJzAnKSAiMDEwMDAwMTAi4oC/IjAxMDEwMDAxIuKAvyIwMTAwMTExMCI=">↗️</a><pre>    <span class='String'>@</span><span class='Modifier2'></span><span class='Function'>+</span> <span class='Function'>+</span><span class='Modifier'>´¨</span> <span class='Paren'>(</span><span class='Function'></span><span class='Number'>2</span><span class='Function'>⋆↕</span><span class='Number'>8</span><span class='Paren'>)</span><span class='Modifier2'></span><span class='Function'>×</span><span class='Modifier'>¨</span> <span class='Function'>-</span><span class='Modifier2'></span><span class='String'>'0'</span> <span class='String'>&quot;01000010&quot;</span><span class='Ligature'></span><span class='String'>&quot;01010001&quot;</span><span class='Ligature'></span><span class='String'>&quot;01001110&quot;</span>
"BQN"

    <span class='Paren'>(</span><span class='String'>@</span><span class='Modifier2'></span><span class='Function'>+</span><span class='Paren'>)</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Function'>+</span><span class='Modifier'>´¨</span><span class='Paren'>)</span><span class='Modifier2'></span><span class='Paren'>((</span><span class='Function'></span><span class='Number'>2</span><span class='Function'>⋆↕</span><span class='Number'>8</span><span class='Paren'>)</span><span class='Modifier2'></span><span class='Function'>×</span><span class='Modifier'>¨</span><span class='Paren'>)</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Function'>-</span><span class='Modifier2'></span><span class='String'>'0'</span><span class='Paren'>)</span> <span class='String'>&quot;01000010&quot;</span><span class='Ligature'></span><span class='String'>&quot;01010001&quot;</span><span class='Ligature'></span><span class='String'>&quot;01001110&quot;</span>
"BQN"
</pre>
<p>We might clean up a little by combining the functions that use <code><span class='Modifier'>¨</span></code>. Here <code><span class='Function'>+</span><span class='Modifier'>´</span></code> doesn't need parentheses because it comes at the left of a group of modifiers. For that matter, neither does <code><span class='String'>@</span><span class='Modifier2'></span><span class='Function'>+</span></code>.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=QOKKuCviiJgoK8K04oiYKCjijL0y4ouG4oaVOCniirjDlynCqCniiJgoLeKfnCcwJykgIjAxMDAwMDEwIuKAvyIwMTAxMDAwMSLigL8iMDEwMDExMTAi">↗️</a><pre>    <span class='String'>@</span><span class='Modifier2'></span><span class='Function'>+</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Function'>+</span><span class='Modifier'>´</span><span class='Modifier2'></span><span class='Paren'>((</span><span class='Function'></span><span class='Number'>2</span><span class='Function'>⋆↕</span><span class='Number'>8</span><span class='Paren'>)</span><span class='Modifier2'></span><span class='Function'>×</span><span class='Paren'>)</span><span class='Modifier'>¨</span><span class='Paren'>)</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Function'>-</span><span class='Modifier2'></span><span class='String'>'0'</span><span class='Paren'>)</span> <span class='String'>&quot;01000010&quot;</span><span class='Ligature'></span><span class='String'>&quot;01010001&quot;</span><span class='Ligature'></span><span class='String'>&quot;01001110&quot;</span>
"BQN"
</pre>
<p>Because <code><span class='Function'>×</span></code> is commutative, the argument <code><span class='Paren'>(</span><span class='Function'></span><span class='Number'>2</span><span class='Function'>⋆↕</span><span class='Number'>8</span><span class='Paren'>)</span></code> can be placed on either side. While I usually default to Before, in this case moving it to the right lets us remove a set of parentheses and use the dot product <code><span class='Function'>+</span><span class='Modifier'>´</span><span class='Modifier2'></span><span class='Function'>×</span></code>, a nice combination.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=QOKKuCviiJgoK8K04oiYw5fin5wo4oy9MuKLhuKGlTgpwqgp4oiYKC3in5wnMCcpICIwMTAwMDAxMCLigL8iMDEwMTAwMDEi4oC/IjAxMDAxMTEwIg==">↗️</a><pre>    <span class='String'>@</span><span class='Modifier2'></span><span class='Function'>+</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Function'>+</span><span class='Modifier'>´</span><span class='Modifier2'></span><span class='Function'>×</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Function'></span><span class='Number'>2</span><span class='Function'>⋆↕</span><span class='Number'>8</span><span class='Paren'>)</span><span class='Modifier'>¨</span><span class='Paren'>)</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Function'>-</span><span class='Modifier2'></span><span class='String'>'0'</span><span class='Paren'>)</span> <span class='String'>&quot;01000010&quot;</span><span class='Ligature'></span><span class='String'>&quot;01010001&quot;</span><span class='Ligature'></span><span class='String'>&quot;01001110&quot;</span>
"BQN"
</pre>
<p>There's another algorithm (<a href="https://en.wikipedia.org/wiki/Horner%27s_method">Horner's rule</a>) that gives us somewhat simpler code. The idea is that instead of multiplying a number by its place value, we split the number into its lowest digit, and the rest. In base 10, for example, we might have <code><span class='Number'>1234</span> <span class='Function'>=</span> <span class='Paren'>(</span><span class='Number'>123</span><span class='Function'>×</span><span class='Number'>10</span><span class='Paren'>)</span><span class='Function'>+</span><span class='Number'>4</span></code>. After performing that expansion three more times, we have:</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=KCgoKCgxw5cxMCkrMinDlzEwKSszKcOXMTApKzQKKCgxw5fin5wxMOKKuCsyKcOX4p+cMTDiirgrMynDl+KfnDEw4oq4KzQgICAjIE1ha2UgdGhlIGNvbWJpbmluZyBzdGVwIGEgZnVuY3Rpb24KNCvin5woMTDiirjDlykzK+KfnCgxMOKKuMOXKTIr4p+cKDEw4oq4w5cpMSAjIEZsaXAgdGhlIGNvbWJpbmluZyBmdW5jdGlvbiBhcm91bmQKK+KfnCgxMOKKuMOXKcK0IDTigL8z4oC/MuKAvzEgICAgICAgICAgICAjIE5vdyBpdCdzIGEgQlFOIGZvbGQKK+KfnCgxMOKKuMOXKcK0IOKMvSAx4oC/MuKAvzPigL80ICAgICAgICAgICMgVG8gZm9sZCBpbiByZXZlcnNlLCByZXZlcnNlIHRoZW4gZm9sZA==">↗️</a><pre>    <span class='Paren'>(((((</span><span class='Number'>1</span><span class='Function'>×</span><span class='Number'>10</span><span class='Paren'>)</span><span class='Function'>+</span><span class='Number'>2</span><span class='Paren'>)</span><span class='Function'>×</span><span class='Number'>10</span><span class='Paren'>)</span><span class='Function'>+</span><span class='Number'>3</span><span class='Paren'>)</span><span class='Function'>×</span><span class='Number'>10</span><span class='Paren'>)</span><span class='Function'>+</span><span class='Number'>4</span>
1234
    <span class='Paren'>((</span><span class='Number'>1</span><span class='Function'>×</span><span class='Modifier2'></span><span class='Number'>10</span><span class='Modifier2'></span><span class='Function'>+</span><span class='Number'>2</span><span class='Paren'>)</span><span class='Function'>×</span><span class='Modifier2'></span><span class='Number'>10</span><span class='Modifier2'></span><span class='Function'>+</span><span class='Number'>3</span><span class='Paren'>)</span><span class='Function'>×</span><span class='Modifier2'></span><span class='Number'>10</span><span class='Modifier2'></span><span class='Function'>+</span><span class='Number'>4</span>   <span class='Comment'># Make the combining step a function
</span>1234
    <span class='Number'>4</span><span class='Function'>+</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Number'>10</span><span class='Modifier2'></span><span class='Function'>×</span><span class='Paren'>)</span><span class='Number'>3</span><span class='Function'>+</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Number'>10</span><span class='Modifier2'></span><span class='Function'>×</span><span class='Paren'>)</span><span class='Number'>2</span><span class='Function'>+</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Number'>10</span><span class='Modifier2'></span><span class='Function'>×</span><span class='Paren'>)</span><span class='Number'>1</span> <span class='Comment'># Flip the combining function around
</span>1234
    <span class='Function'>+</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Number'>10</span><span class='Modifier2'></span><span class='Function'>×</span><span class='Paren'>)</span><span class='Modifier'>´</span> <span class='Number'>4</span><span class='Ligature'></span><span class='Number'>3</span><span class='Ligature'></span><span class='Number'>2</span><span class='Ligature'></span><span class='Number'>1</span>            <span class='Comment'># Now it's a BQN fold
</span>1234
    <span class='Function'>+</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Number'>10</span><span class='Modifier2'></span><span class='Function'>×</span><span class='Paren'>)</span><span class='Modifier'>´</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><span class='Ligature'></span><span class='Number'>4</span>          <span class='Comment'># To fold in reverse, reverse then fold
</span>1234
</pre>
<p>(Why does <code><span class='Function'>+</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Number'>10</span><span class='Modifier2'></span><span class='Function'>×</span><span class='Paren'>)</span></code> need parentheses when <code><span class='Function'>×</span><span class='Modifier2'></span><span class='Number'>10</span><span class='Modifier2'></span><span class='Function'>+</span></code> doesn't? Why doesn't the reversed expression have outer parentheses?). Changing this from base 10 to base 2 is pretty simple (although a character-counter might not stop until reaching the less obvious function <code><span class='Function'>+</span><span class='Modifier'>˜</span><span class='Modifier2'></span><span class='Function'>+</span><span class='Modifier'>˜´</span><span class='Modifier2'></span><span class='Function'></span></code>).</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=K8K04oiYw5fin5wo4oy9MuKLhuKGlTgpICIwMTAxMDAwMSItJzAnCivin5woMuKKuMOXKcK04oiY4oy9ICIwMTAxMDAwMSItJzAn">↗️</a><pre>    <span class='Function'>+</span><span class='Modifier'>´</span><span class='Modifier2'></span><span class='Function'>×</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Function'></span><span class='Number'>2</span><span class='Function'>⋆↕</span><span class='Number'>8</span><span class='Paren'>)</span> <span class='String'>&quot;01010001&quot;</span><span class='Function'>-</span><span class='String'>'0'</span>
81
    <span class='Function'>+</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Number'>2</span><span class='Modifier2'></span><span class='Function'>×</span><span class='Paren'>)</span><span class='Modifier'>´</span><span class='Modifier2'></span><span class='Function'></span> <span class='String'>&quot;01010001&quot;</span><span class='Function'>-</span><span class='String'>'0'</span>
81
</pre>
<p>Plugging that back in, we have another base-decoding function:</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=QOKKuCviiJgoK+KfnCgy4oq4w5cpwrTiiJjijL3CqCniiJgoLeKfnCcwJykgIjAxMDAwMDEwIuKAvyIwMTAxMDAwMSLigL8iMDEwMDExMTAi">↗️</a><pre>    <span class='String'>@</span><span class='Modifier2'></span><span class='Function'>+</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Function'>+</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Number'>2</span><span class='Modifier2'></span><span class='Function'>×</span><span class='Paren'>)</span><span class='Modifier'>´</span><span class='Modifier2'></span><span class='Function'></span><span class='Modifier'>¨</span><span class='Paren'>)</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Function'>-</span><span class='Modifier2'></span><span class='String'>'0'</span><span class='Paren'>)</span> <span class='String'>&quot;01000010&quot;</span><span class='Ligature'></span><span class='String'>&quot;01010001&quot;</span><span class='Ligature'></span><span class='String'>&quot;01001110&quot;</span>
"BQN"
</pre>
<p>With the still-mysterious trains, this function could even be cleaned up more, removing the clutter of <code><span class='Modifier2'></span></code>s and <code><span class='Paren'>()</span></code>s that makes it hard to focus on what one part of the function is doing:</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=KEArIMK3K+KfnCgy4oq4w5cpwrTiiJjijL3CqCAt4p+cJzAnKSAiMDEwMDAwMTAi4oC/IjAxMDEwMDAxIuKAvyIwMTAwMTExMCI=">↗️</a><pre>    <span class='Paren'>(</span><span class='String'>@</span><span class='Function'>+</span> <span class='Nothing'>·</span><span class='Function'>+</span><span class='Modifier2'></span><span class='Paren'>(</span><span class='Number'>2</span><span class='Modifier2'></span><span class='Function'>×</span><span class='Paren'>)</span><span class='Modifier'>´</span><span class='Modifier2'></span><span class='Function'></span><span class='Modifier'>¨</span> <span class='Function'>-</span><span class='Modifier2'></span><span class='String'>'0'</span><span class='Paren'>)</span> <span class='String'>&quot;01000010&quot;</span><span class='Ligature'></span><span class='String'>&quot;01010001&quot;</span><span class='Ligature'></span><span class='String'>&quot;01001110&quot;</span>
"BQN"
</pre>
<h2 id="summary"><a class="header" href="#summary">Summary</a></h2>
<p>BQN has a full complement of comparison functions, which are pervasive (work on atoms only) like arithmetic functions. The non-pervasive functions Match (<code><span class='Function'></span></code>) and Not Match (<code><span class='Function'></span></code>) compare entire arrays. Comparison functions return <code><span class='Number'>1</span></code> if the comparison holds and <code><span class='Number'>0</span></code> if it doesn't; these two numbers make up the &quot;booleans&quot;.</p>
<table>
<thead>
<tr>
<th>Glyph</th>
<th>1 arg</th>
<th>2 args</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><span class='Function'>&lt;</span></code></td>
<td></td>
<td><a href="../doc/arithmetic.html#comparisons">Less Than</a></td>
</tr>
<tr>
<td><code><span class='Function'>&gt;</span></code></td>
<td></td>
<td><a href="../doc/arithmetic.html#comparisons">Greater Than</a></td>
</tr>
<tr>
<td><code><span class='Function'></span></code></td>
<td><a href="../doc/shape.html">Length</a></td>
<td><a href="../doc/arithmetic.html#comparisons">Not Equals</a></td>
</tr>
<tr>
<td><code><span class='Function'>=</span></code></td>
<td><a href="../doc/shape.html">Rank</a></td>
<td><a href="../doc/arithmetic.html#comparisons">Equals</a></td>
</tr>
<tr>
<td><code><span class='Function'></span></code></td>
<td></td>
<td><a href="../doc/arithmetic.html#comparisons">Less Than or Equal to</a></td>
</tr>
<tr>
<td><code><span class='Function'></span></code></td>
<td></td>
<td><a href="../doc/arithmetic.html#comparisons">Greater Than or Equal to</a></td>
</tr>
<tr>
<td><code><span class='Function'></span></code></td>
<td><a href="../doc/depth.html">Depth</a></td>
<td><a href="../doc/match.html">Match</a></td>
</tr>
<tr>
<td><code><span class='Function'></span></code></td>
<td></td>
<td><a href="../doc/match.html">Not Match</a></td>
</tr>
</tbody>
</table>
<p>A combinator is a function or modifier that produces its result from its inputs purely by applying functions to arguments, without introducing any external values. BQN's combinators can all be described with diagrams showing how arguments are passed through operands, with the result emerging at the top. The diagrams below define six combinators in BQN.</p>
<svg viewBox='0 0 850 530'>
  <g font-size='20px' text-anchor='middle' transform='translate(145,20)'>
    <rect class='code' stroke-width='1' rx='12' x='-120.4' y='1' width='240.8' height='205'/>
    <text dy='0.32em' y='223' fill='currentColor'>Atop</text>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(-60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L0 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 57L0 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='0' y='57'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='0' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Value'>𝕨</tspan> <tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L0 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 57L-32 114'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 57L32 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='114'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='0' y='57'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='-32' y='114'><tspan class='Value'>𝕨</tspan></text>
      <text dy='0.32em' x='32' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
  </g>
  <g font-size='20px' text-anchor='middle' transform='translate(425,20)'>
    <rect class='code' stroke-width='1' rx='12' x='-120.4' y='1' width='240.8' height='205'/>
    <text dy='0.32em' y='223' fill='currentColor'>Self/Swap</text>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(-60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Function'>𝔽</tspan><tspan class='Modifier'>˜</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0Q-41.6 57 0 114'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0Q41.6 57 0 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='0' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Value'>𝕨</tspan> <tspan class='Function'>𝔽</tspan><tspan class='Modifier'>˜</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0C-40 28.5 0 57 32 114'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0C40 28.5 0 57 -32 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='114'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='-32' y='114'><tspan class='Value'>𝕨</tspan></text>
      <text dy='0.32em' x='32' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
  </g>
  <g font-size='20px' text-anchor='middle' transform='translate(705,20)'>
    <rect class='code' stroke-width='1' rx='12' x='-120.4' y='1' width='240.8' height='205'/>
    <text dy='0.32em' y='223' fill='currentColor'>Constant</text>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(-60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Value'>𝕗</tspan><tspan class='Modifier'>˙</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L0 57'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='114'/>
      <text dy='0.32em' x='0' y='57'><tspan class='Value'>𝕗</tspan></text>
      <text dy='0.32em' x='0' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Value'>𝕨</tspan> <tspan class='Value'>𝕗</tspan><tspan class='Modifier'>˙</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L0 57'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='114'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='114'/>
      <text dy='0.32em' x='0' y='57'><tspan class='Value'>𝕗</tspan></text>
      <text dy='0.32em' x='-32' y='114'><tspan class='Value'>𝕨</tspan></text>
      <text dy='0.32em' x='32' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
  </g>
  <g font-size='20px' text-anchor='middle' transform='translate(145,280)'>
    <rect class='code' stroke-width='1' rx='12' x='-120.4' y='1' width='240.8' height='205'/>
    <text dy='0.32em' y='223' fill='currentColor'>Over</text>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(-60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L0 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 57L0 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='0' y='57'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='0' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Value'>𝕨</tspan> <tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L-32 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M-32 57L-32 114'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L32 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M32 57L32 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='114'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='-32' y='57'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='32' y='57'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='-32' y='114'><tspan class='Value'>𝕨</tspan></text>
      <text dy='0.32em' x='32' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
  </g>
  <g font-size='20px' text-anchor='middle' transform='translate(425,280)'>
    <rect class='code' stroke-width='1' rx='12' x='-120.4' y='1' width='240.8' height='205'/>
    <text dy='0.32em' y='223' fill='currentColor'>Before</text>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(-60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L-32 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M-32 57L0 114'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0Q41.6 57 0 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='-32' y='57'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='0' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Value'>𝕨</tspan> <tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L-32 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M-32 57L-32 114'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0C40 57 32 51.3 32 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='114'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='-32' y='57'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='-32' y='114'><tspan class='Value'>𝕨</tspan></text>
      <text dy='0.32em' x='32' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
  </g>
  <g font-size='20px' text-anchor='middle' transform='translate(705,280)'>
    <rect class='code' stroke-width='1' rx='12' x='-120.4' y='1' width='240.8' height='205'/>
    <text dy='0.32em' y='223' fill='currentColor'>After</text>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(-60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0Q-41.6 57 0 114'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L32 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M32 57L0 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='32' y='57'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='0' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
    <g font-size='21px' font-family='BQN,monospace' transform='translate(60.87,25)'>
      <text dy='0.32em' y='155' font-size='19px'><tspan class='Value'>𝕨</tspan> <tspan class='Function'>𝔽</tspan><tspan class='Modifier2'></tspan><tspan class='Function'>𝔾</tspan> <tspan class='Value'>𝕩</tspan></text>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0C-40 57 -32 51.3 -32 114'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M0 0L32 57'/>
      <path class='yellow' style='fill:none' stroke-width='2' d='M32 57L32 114'/>
      <circle r='12' class='code' stroke-width='0' cx='0' cy='0'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='57'/>
      <circle r='12' class='code' stroke-width='0' cx='-32' cy='114'/>
      <circle r='12' class='code' stroke-width='0' cx='32' cy='114'/>
      <text dy='0.32em' x='0' y='0'><tspan class='Function'>𝔽</tspan></text>
      <text dy='0.32em' x='32' y='57'><tspan class='Function'>𝔾</tspan></text>
      <text dy='0.32em' x='-32' y='114'><tspan class='Value'>𝕨</tspan></text>
      <text dy='0.32em' x='32' y='114'><tspan class='Value'>𝕩</tspan></text>
    </g>
  </g>
</svg>

<p>A data value (number, character, or array) can be applied as a function, in which case it ignores any arguments and returns itself. In particular, using a data value as the left operand of Before or the right operand of After is called Bind because it attaches that data value as an argument to the other operand.</p>
<p>This section was a bit long because combinators are conceptually difficult, but as you can see we didn't cover all that much material (and our diagrams <em>fully</em> define the combinators in question, which is unusual in a summary!). The tacit style we've used here can be very confusing or uncomfortable at first, maybe <em>because</em> it's so radically simple. We'll keep working with it in future tutorials, and it should start to feel more solid and logical. Even if not, that's okay! As I said, BQN has a more explicit function style as well, and it's completely possible to program without ever using a combinator. But perhaps you'll find that a well-placed Over or Bind can make things a lot smoother.</p>