-
Notifications
You must be signed in to change notification settings - Fork 0
/
oldAODict.ao
4484 lines (4105 loc) · 241 KB
/
oldAODict.ao
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
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
@#.abc v#{%integer}c
@p rwrzwll
@.mul {%p}rr*l
@* {%.mul}
@.add {%p}rr+l
@+ {%.add}
@.neg r-l
@.sub {%.neg}{%.add}
@- {%.sub}
@put wrzl
@drop r%
@drop2 {%drop}{%drop}
@handStackSwap w
@hsw {%handStackSwap}
@discard2 {%hsw}{%drop2}{%hsw}
@intro1 vvrwlcl
@inL rVl
@inR rVVRWLCl
@b-a.compareStreams {%drop2}{%discard2}{%intro1}{%inL}{%inR}
@-ab.compareStreams {%drop2}{%discard2}{%intro1}{%inL}
@.prebind_l r[l]{%block}rol
@.rw rw
@.wl wl
@w rrwll
@pw {%p}{%w}
@distrib {%p}rrDl
@.eitherBind {%pw}{%distrib}r[rw%vrw'oc]{%block}r?VRW[r%vrw'oc]{%block}r?WLCl
@eitherBind {%.prebind_l}{%.rw}{%.prebind_l}{%.wl}{%.eitherBind}
@merge rMl
@inline rvr$c
@if {%eitherBind}{%merge}{%inline}
@-a.compareStreams {%put}[{%b-a.compareStreams}]{%block}[{%-ab.compareStreams}]{%block}{%if}
@inner..abs #{%integer}r>[-vrw%c]{%block}r?VRW[%]{%block}r?WLCM
@.abs r{%inner..abs}l
@onElem.addend.s rw'ovrwrwz'owlVc
@onFini.addend.s r%vr$c
@step.addend.s lwvvrwlcw$wD[{%onElem.addend.s}]{%block}r?VRW[{%onFini.addend.s}]{%block}r?WLCMc
@.firstfixfirst#v2 '[^'ow^'zowvr$c]{%block}r^'owo
@.firstfixfirst {%.firstfixfirst#v2}
@.addend.s [{%step.addend.s}]{%block}r{%.firstfixfirst}w'ow'o
@.app1 vvr$c
@.app1e vvrrz$lc
@.apply {%p}rr$l
@.apply1 r{%.app1e}l
@swap rwrwzwlwl
@.applyd {%swap}{%.apply}
@.assertFirstUnit vrvrwlcrwlc
@.assertUnit vvrwlcc
@bind {%pw}rr'[l]{%block}rwool
@.bapply [{%.apply}]{%block}{%bind}
@.bfirst r'[$]{%block}rwol
@dup r^zlwl
@swapd {%.rw}{%swap}{%.wl}
@tuck {%dup}{%swapd}
@.bi {%tuck}{%.apply}{%.rw}{%.apply}{%.wl}
@.bi& {%dup}{%.rw}{%.apply}{%swap}{%.wl}{%.apply}{%swap}
@.bind {%pw}rr'ol
@.swap vrwlc
@compose {%pw}rrol
@composel {%swap}{%compose}
@.bind2nd [{%.swap}]{%block}{%composel}{%.bind}
@.bleft r'[v]{%block}ro[?c]{%block}rwol
@take {%hsw}{%put}{%hsw}
@x rrwzlwl
@.first {%take}{%x}{%put}{%.apply}{%p}
@.second {%take}{%pw}{%put}{%.first}{%pw}
@.both {%take}{%.first}{%put}{%.second}
@.bright r'[vVRW]{%block}ro[?WLCc]{%block}rwol
@.bsecond r'[vrw]{%block}ro[$wlc]{%block}rwol
@.curry [{%.bind}]{%block}{%bind}
@.inv r/l
@.div {%.inv}{%.mul}
@wx {%w}{%x}
@.divMod {%p}rrQll{%wx}
@unrot {%swap}{%swapd}
@.left {%p}rr?l
@not rVRWLCl
@notd {%swap}{%not}{%swap}
@.right {%notd}{%.left}{%not}
@.either {%unrot}{%.left}{%swap}{%.right}
@.firstfixfirst#v1 [^'o]{%block}ro^'o
@.fixfirst r{%.firstfixfirst}l
@onElem.flatten.s wvrwrw'o{%.addend.s}vr$c
@.inR vVVRWLCc
@step.flatten.s wvvrwlcw$wD[{%onElem.flatten.s}]{%block}r?VRW[%{%.inR}]{%block}r?WLCMc
@.flatten.s [{%step.flatten.s}]{%block}r{%.firstfixfirst}w'o
@onElem.fmap.s rz$vrwrw'owlc
@step.fmap.s lwvvrwlcw$wD[{%onElem.fmap.s}]{%block}r?VRW[%]{%block}r?WLCc
@.fmap.s [{%step.fmap.s}]{%block}rw'o{%.firstfixfirst}w'o
@next.fromStateSplitNext.r rrr%z$rz'olc
@split.fromStateSplitNext.r rrrw%z$rzw^zw'owzw'olc
@step.fromStateSplitNext.r llvrD[{%next.fromStateSplitNext.r}]{%block}r?VRW[{%split.fromStateSplitNext.r}]{%block}r?WLCMc
@.fromStateSplitNext.r {%pw}[{%step.fromStateSplitNext.r}]{%block}{%.bind}{%.fixfirst}{%.bind}
@.fst vrw%c
@.gt {%p}rr>l
@.mirror VRWLC
@.snd vr%c
@.lte1 {%p}rr>[{%.fst}]{%block}r?{%.mirror}[{%.snd}]{%block}r?l
@.gt1 {%.lte1}{%not}
@trimBoolean\1e Fw%
@toBoolean\1e vvrwlcD{%trimBoolean\1e}
@toBoolean r{%toBoolean\1e}l
@.gtb {%.gt}{%toBoolean}
@.lt {%p}rrw>l
@.gte {%.lt}{%not}
@.gte1 {%p}rrw>[{%.snd}]{%block}r?{%.mirror}[{%.fst}]{%block}r?l
@.gteb {%.gte}{%toBoolean}
@.inL vVc
@.lt1 {%.gte1}{%not}
@.ltb {%.lt}{%toBoolean}
@.lte {%.gt}{%not}
@.lteb {%.lte}{%toBoolean}
@onElem.pmap.s rz$rz'ovrwrwz'owlc
@step.pmap.s wlwvvrwlcw$wD[{%onElem.pmap.s}]{%block}r?VRW[%]{%block}r?WLCc
@.pmap.s [{%step.pmap.s}]{%block}r{%.firstfixfirst}w'ow'o
@.postbind_pw r[{%pw}]{%block}rwol
@.quot {%p}rrQ%l
@.rem {%p}rrQw%l
@.square {%dup}{%.mul}
@step.state.p0 wvrwr$rz'olc
@.state.p0 [{%step.state.p0}]{%block}{%.bind}{%.fixfirst}{%.bind}
@.tri {%tuck}{%.apply}{%.rw}{%.bi}{%.wl}
@rot {%swapd}{%swap}
@.tri& {%dup}{%.rw}{%.apply}{%rot}{%.wl}{%dup}{%.rw}{%.apply}{%rot}{%.wl}{%.apply}{%rot}
@/ {%.div}
@ll.compareSums {%pw}{%.wl}{%.apply}{%.wl}{%drop}
@rl.compareSums {%drop2}{%.wl}{%drop}{%.wl}{%drop}{%intro1}{%inR}{%inR}
@?l.compareSums {%.rw}[{%.wl}{%ll.compareSums}]{%block}[{%.wl}{%rl.compareSums}]{%block}{%if}
@lr.compareSums {%drop2}{%.wl}{%drop}{%.wl}{%drop}{%intro1}{%inL}{%inR}
@rr.compareSums {%pw}{%.wl}{%drop}{%.wl}{%.apply}
@?r.compareSums {%.rw}[{%.wl}{%lr.compareSums}]{%block}[{%.wl}{%rr.compareSums}]{%block}{%if}
@C.abc C
@EQ {%intro1}{%inL}
@inRR {%inR}{%inR}
@GT {%intro1}{%inRR}
@L.abc L
@empty.l {%intro1}{%inR}
@cons.l {%p}{%inL}
@LF {%empty.l}#10{%integer}{%cons.l}
@inRL {%inL}{%inR}
@LT {%intro1}{%inRL}
@R.abc R
@TODO.AO "Much to do about AO
* functions for association lists, maps, records, or similar
* maybe support for tables, too; relational algebra
* ideally a DSL supporting composition, optimization, compilation
* consider 'measured' trees, with arbitrary monoid to cache information
* e.g. size information
* persistent union-find
* working with embedded binary data (alphabet a-z minus aeiou,vrwlc).
* access to bytecodes: reflection/introspection
* transpile ABC to JavaScript
* functions for matrices and vector
* look into FGL graph library (manipulating graphs with a zipper)
* functions for sequences (finger-trees/ropes)
* functions for parser combinators; grammar DSL
* should support derivative grammars & deep optimizations
* AO bootstrap; optimizers and compilers for ABC, AO
* eventually do typechecking
* eventually get to AMBC
* develop a colors/materials model?
* named palette plus RGB? meh.
* a DSL for mixing, lightening, and darkening colors?
* maybe a richer 'materials' model (cf. POV-ray)
* with shine, roughness, transparency, etc.
* procedural texture generation, perlin noise
* automatic generation from images
* suitable for use in games...
* functions for text, utf-8, binary, base64
* implement as stream transformers?
* functions for kd-trees, geometries, scene-graphs
* functions for textures, jpegs, gifs, compression and decompression
* contraint models for staged dependency/policy/typeclass injection
* project euler? rosetta code? a simple tetris/breakout game?
* need a lot more performance, first!
* simplified app type for quick integration with Haskell? (use plugins?)
* 2D-3D scene-graphs based on enneatrees and zippers
* secure pseduo-random number generators; probabilistic programs
* math libs - linear algebra, symbolic maths
* knowledge database or encyclopaedia?
* unicode
* world data? (countries, flags, populations, maps)
AO's design philosophy is actually similar to Wolfram's - that code should have easy access to vast quantities of useful, maintainable data. AO provides this access in the form of words in a very large dictionary.
~{%literal}
@TODO.RandomNumbers "To really support random numbers, I require a lot more work.
I should be able to:
* generate arbitrary K-bit words and fractionals (trivial!)
* generate arbitrary uniforms (e.g. 6 sided dice)
* model 'weighted' dice
A lot work exists in this area. Relevant keywords and articles:
* sampling from a discrete distribution
* Darts, Dice, and Coins: http://www.keithschwarz.com/darts-dice-coins/
* Alias method
* Vose's algorithm
~{%literal}
@V.abc V
@W.abc W
@Z.abc Z
@a-b.compareStreams {%drop2}{%discard2}{%intro1}{%inR}{%inR}
@dx {%.rw}{%x}{%.wl}
@discard {%put}{%drop}
@nip2 {%.rw}{%drop2}{%.wl}
@ab.compareStreams {%dx}{%x}{%swapd}{%pw}{%put}{%.apply}[{%drop}{%put}{%inline}]{%block}[{%inR}{%discard}{%nip2}]{%block}{%if}
@a.compareStreams {%put}[{%ab.compareStreams}]{%block}[{%a-b.compareStreams}]{%block}{%if}
@abcBase16Alphabet "bdfghjkmnpqstxyz
~{%literal}
@abs\1 v{%inner..abs}c
@dpw {%.rw}{%pw}{%.wl}
@dip rwrzvrwr$wlcl
@action.each.l {%wx}wlwl{%dpw}{%dip}{%wx}{%inline}
@roll {%.rw}{%rot}{%.wl}{%swap}
@action.eachUntil.l {%wx}{%roll}{%pw}{%rot}{%dip}{%wx}{%inline}
@dec r#1-{%integer}r+l
@put2 {%put}{%put}
@dip2 rwrwrzlzvrwr$wlcrzlwl
@dip3 {%dpw}{%dip2}{%wx}
@action.forCount.l {%dec}{%put}{%x}{%unrot}{%put2}{%dip3}{%inline}
@copy {%dup}{%take}
@neq rwrzw>[vr>c]{%block}r?Rl
@neq1 {%neq}r[{%.snd}]{%block}r?VRWR[{%.fst}]{%block}r?W[{%.snd}]{%block}r?WLWLCl
@eq1 {%neq1}{%not}
@eq1m {%eq1}[vMc]{%block}{%.left}
@neq1m {%eq1m}{%not}
@wrapfn {%swapd}{%compose}{%compose}
@wrapCons.mapReverseAppend.l [{%dip}]{%block}{%bind}[{%swap}]{%block}[{%swap}{%cons.l}]{%block}{%wrapfn}
@elim1 rvrwlcc
@fini.each.l {%elim1}wl{%drop}wl{%drop}
@step.each.l wzw[{%action.each.l}]{%block}[{%fini.each.l}]{%block}{%if}
@each.l [{%step.each.l}]{%block}{%.bind}{%.fixfirst}{%inline}
@mapReverseAppend.l {%wrapCons.mapReverseAppend.l}{%each.l}
@mapReverse.l {%empty.l}{%unrot}{%mapReverseAppend.l}
@dwx {%.rw}{%wx}{%.wl}
@pushrv.partition.l [{%dx}{%cons.l}{%p}]{%block}[{%dwx}{%cons.l}{%pw}]{%block}{%if}
@compressArgs {%dpw}[{%wx}]{%block}{%composel}
@apply1to1.stackHand.env rwrzvrwvvrrvrrz$wlcllccwlcl
@apply1to1.std.env {%apply1to1.stackHand.env}
@apply {%apply1to1.std.env}
@apply1to1 {%apply}
@apply2to1 {%compressArgs}{%apply1to1}
@apply3to1 {%compressArgs}{%apply2to1}
@fold.l [{%each.l}]{%block}{%apply3to1}
@partitionAppendReverse.l {%unrot}{%pw}{%swap}[{%pushrv.partition.l}]{%block}{%fold.l}{%wx}
@partitionReverse.l {%empty.l}{%empty.l}{%rot}{%partitionAppendReverse.l}
@partitionWith.l {%mapReverse.l}{%partitionReverse.l}
@nip {%.rw}{%drop}{%.wl}
@dropd {%nip}
@filterWith.l {%partitionWith.l}{%dropd}
@remove.l [{%neq1m}]{%block}{%bind}{%filterWith.l}
@action.nub.l {%x}{%copy}{%remove.l}{%swap}{%apply}{%put}{%cons.l}
@dupd {%.rw}{%dup}{%.wl}
@keep {%dupd}{%dip}
@wrapObserver.b [{%keep}]{%block}{%bind}[{%distrib}[c]{%block}{%.left}[c]{%block}{%.right}]{%block}{%compose}
@partitionBy.l {%wrapObserver.b}{%partitionWith.l}
@action.nubBy.l {%x}{%copy}{%rot}{%bind}{%partitionBy.l}{%drop}{%swap}{%apply}{%put}{%cons.l}
@action.repeat {%dec}{%unrot}{%dip2}{%inline}
@add.abc +
@unseal.stats r{.stats}l
@inc r#1{%integer}r+l
@paste {%hsw}{%copy}{%hsw}
@seal.stats r{:stats}l
@add.stats {%take}{%unseal.stats}{%x}{%inc}{%swap}{%x}{%paste}{%.add}{%swap}{%put}{%dup}{%.mul}{%.add}{%pw}{%pw}{%seal.stats}
@add\2 vr+c
@addend.s [{%step.addend.s}]{%block}{%.fixfirst}{%.bind}{%.bind}
@aff.abc f
@affine rfl
@alignToFrac {%dup}rw{%.quot}wl{%.mul}
@and.b {%distrib}rVRW[c]{%block}r?WLCL[v%]{%block}r?l
@ap.abc $
@dp {%.rw}{%p}{%.wl}
@bindKVCmp.AATree {%dx}{%dupd}{%.bind}{%dp}
@node.insertKV.AATree {%dx}{%dx}{%dup}{%.apply}{%dp}{%dp}{&TODO: insert node then rebalance.}
@taked {%swap}{%take}
@hfix#v3 {%put}r[l{%take}]{%block}rol{%.fixfirst}{%take}
@hfix {%hfix#v3}
@hap {%put}{%inline}
@empty.AATree {%intro1}{%inR}
@singleton.AATree {%empty.AATree}{%empty.AATree}{%inR}{%pw}{%pw}{%inL}
@leaf.insertKV.AATree {%discard}{%put}{%singleton.AATree}{%swap}{%inR}
@tree.insertKV.AATree [{%hap}]{%block}[{%leaf.insertKV.AATree}]{%block}{%if}
@apEnv.insertKV.AATree {%bindKVCmp.AATree}[{%node.insertKV.AATree}]{%block}{%bind}{%taked}{%take}{%hfix}{%tree.insertKV.AATree}
@apcar {%dx}{%.apply}{%p}
@apcaar {%dx}{%apcar}{%p}
@apcaaar {%dx}{%apcaar}{%p}
@apcaaaar {%dx}{%apcaaar}{%p}
@apcaaaaar {%dx}{%apcaaaar}{%p}
@apcaaaadr {%dwx}{%apcaaaar}{%pw}
@apcaaadr {%dwx}{%apcaaar}{%pw}
@apcaaadar {%dx}{%apcaaadr}{%p}
@apcaaaddr {%dwx}{%apcaaadr}{%pw}
@apcaadr {%dwx}{%apcaar}{%pw}
@apcaadar {%dx}{%apcaadr}{%p}
@apcaadaar {%dx}{%apcaadar}{%p}
@apcaadadr {%dwx}{%apcaadar}{%pw}
@apcaaddr {%dwx}{%apcaadr}{%pw}
@apcaaddar {%dx}{%apcaaddr}{%p}
@apcaadddr {%dwx}{%apcaaddr}{%pw}
@apcadr {%dwx}{%apcar}{%pw}
@apcadar {%dx}{%apcadr}{%p}
@apcadaar {%dx}{%apcadar}{%p}
@apcadaaar {%dx}{%apcadaar}{%p}
@apcadaadr {%dwx}{%apcadaar}{%pw}
@apcadadr {%dwx}{%apcadar}{%pw}
@apcadadar {%dx}{%apcadadr}{%p}
@apcadaddr {%dwx}{%apcadadr}{%pw}
@apcaddr {%dwx}{%apcadr}{%pw}
@apcaddar {%dx}{%apcaddr}{%p}
@apcaddaar {%dx}{%apcaddar}{%p}
@apcaddadr {%dwx}{%apcaddar}{%pw}
@apcadddr {%dwx}{%apcaddr}{%pw}
@apcadddar {%dx}{%apcadddr}{%p}
@apcaddddr {%dwx}{%apcadddr}{%pw}
@apcdr {%dwx}{%.apply}{%pw}
@apcdar {%dx}{%apcdr}{%p}
@apcdaar {%dx}{%apcdar}{%p}
@apcdaaar {%dx}{%apcdaar}{%p}
@apcdaaaar {%dx}{%apcdaaar}{%p}
@apcdaaadr {%dwx}{%apcdaaar}{%pw}
@apcdaadr {%dwx}{%apcdaar}{%pw}
@apcdaadar {%dx}{%apcdaadr}{%p}
@apcdaaddr {%dwx}{%apcdaadr}{%pw}
@apcdadr {%dwx}{%apcdar}{%pw}
@apcdadar {%dx}{%apcdadr}{%p}
@apcdadaar {%dx}{%apcdadar}{%p}
@apcdadadr {%dwx}{%apcdadar}{%pw}
@apcdaddr {%dwx}{%apcdadr}{%pw}
@apcdaddar {%dx}{%apcdaddr}{%p}
@apcdadddr {%dwx}{%apcdaddr}{%pw}
@apcddr {%dwx}{%apcdr}{%pw}
@apcddar {%dx}{%apcddr}{%p}
@apcddaar {%dx}{%apcddar}{%p}
@apcddaaar {%dx}{%apcddaar}{%p}
@apcddaadr {%dwx}{%apcddaar}{%pw}
@apcddadr {%dwx}{%apcddar}{%pw}
@apcddadar {%dx}{%apcddadr}{%p}
@apcddaddr {%dwx}{%apcddadr}{%pw}
@apcdddr {%dwx}{%apcddr}{%pw}
@apcdddar {%dx}{%apcdddr}{%p}
@apcdddaar {%dx}{%apcdddar}{%p}
@apcdddadr {%dwx}{%apcdddar}{%pw}
@apcddddr {%dwx}{%apcdddr}{%pw}
@apcddddar {%dx}{%apcddddr}{%p}
@apcdddddr {%dwx}{%apcddddr}{%pw}
@reverseAppend.l [{%cons.l}]{%block}{%fold.l}
@reverse.l {%empty.l}{%swap}{%reverseAppend.l}
@append.l {%swap}{%reverse.l}{%reverseAppend.l}
@appendl.l {%swap}{%append.l}
@wrap.stackHand.env vvvr
@wrap.std.env {%wrap.stackHand.env}
@preApply {%wrap.std.env}
@unwrap.stackHand.env lccc
@unwrap.std.env {%unwrap.stackHand.env}
@postApply {%unwrap.std.env}
@applyWrap r[{%preApply}]{%block}ro[{%postApply}]{%block}rwol
@apply.alt {%applyWrap}{%.apply}
@apply0to0.stackHand.env rvvvrrvrrz$wlcllccc
@apply0to0.std.env {%apply0to0.stackHand.env}
@apply0to0 {%apply0to0.std.env}
@apply0to1.stackHand.env rvvvrrvrrz$wlcllccwlcl
@apply0to1.std.env {%apply0to1.stackHand.env}
@apply0to1 {%apply0to1.std.env}
@apply0to2 {%.postbind_pw}{%apply0to1}{%wx}
@apply0to3 {%.postbind_pw}{%apply0to2}{%wx}
@apply0to4 {%.postbind_pw}{%apply0to3}{%wx}
@apply0to5 {%.postbind_pw}{%apply0to4}{%wx}
@apply0to6 {%.postbind_pw}{%apply0to5}{%wx}
@apply0to7 {%.postbind_pw}{%apply0to6}{%wx}
@apply1to0.stackHand.env rwrzvrwvvrrvrrz$wlcllccc
@apply1to0.std.env {%apply1to0.stackHand.env}
@apply1to0 {%apply1to0.std.env}
@roll2 {%swap}
@apply1to0d {%roll2}{%apply1to0}
@apply1to1d {%roll2}{%apply1to1}
@apply1to2 {%.postbind_pw}{%apply1to1}{%wx}
@apply1to2d {%roll2}{%apply1to2}
@apply1to3 {%.postbind_pw}{%apply1to2}{%wx}
@apply1to3d {%roll2}{%apply1to3}
@apply1to4 {%.postbind_pw}{%apply1to3}{%wx}
@apply1to4d {%roll2}{%apply1to4}
@apply1to5 {%.postbind_pw}{%apply1to4}{%wx}
@apply1to5d {%roll2}{%apply1to5}
@apply1to6 {%.postbind_pw}{%apply1to5}{%wx}
@apply1to6d {%roll2}{%apply1to6}
@apply1to7 {%.postbind_pw}{%apply1to6}{%wx}
@apply1to7d {%roll2}{%apply1to7}
@apply2to0 {%compressArgs}{%apply1to0}
@roll3 {%rot}
@apply2to0d {%roll3}{%apply2to0}
@apply2to1d {%roll3}{%apply2to1}
@apply2to2 {%compressArgs}{%apply1to2}
@apply2to2d {%roll3}{%apply2to2}
@apply2to3 {%compressArgs}{%apply1to3}
@apply2to3d {%roll3}{%apply2to3}
@apply2to4 {%compressArgs}{%apply1to4}
@apply2to4d {%roll3}{%apply2to4}
@apply2to5 {%compressArgs}{%apply1to5}
@apply2to5d {%roll3}{%apply2to5}
@apply2to6 {%compressArgs}{%apply1to6}
@apply2to6d {%roll3}{%apply2to6}
@apply2to7 {%compressArgs}{%apply1to7}
@apply2to7d {%roll3}{%apply2to7}
@apply3to0 {%compressArgs}{%apply2to0}
@roll4 {%roll}
@apply3to0d {%roll4}{%apply3to0}
@apply3to1d {%roll4}{%apply3to1}
@apply3to2 {%compressArgs}{%apply2to2}
@apply3to2d {%roll4}{%apply3to2}
@apply3to3 {%compressArgs}{%apply2to3}
@apply3to3d {%roll4}{%apply3to3}
@apply3to4 {%compressArgs}{%apply2to4}
@apply3to4d {%roll4}{%apply3to4}
@apply3to5 {%compressArgs}{%apply2to5}
@apply3to5d {%roll4}{%apply3to5}
@apply3to6 {%compressArgs}{%apply2to6}
@apply3to6d {%roll4}{%apply3to6}
@apply3to7 {%compressArgs}{%apply2to7}
@apply3to7d {%roll4}{%apply3to7}
@apply4to0 {%compressArgs}{%apply3to0}
@roll5 {%.rw}{%roll4}{%.wl}{%swap}
@apply4to0d {%roll5}{%apply4to0}
@apply4to1 {%compressArgs}{%apply3to1}
@apply4to1d {%roll5}{%apply4to1}
@apply4to2 {%compressArgs}{%apply3to2}
@apply4to2d {%roll5}{%apply4to2}
@apply4to3 {%compressArgs}{%apply3to3}
@apply4to3d {%roll5}{%apply4to3}
@apply4to4 {%compressArgs}{%apply3to4}
@apply4to4d {%roll5}{%apply4to4}
@apply4to5 {%compressArgs}{%apply3to5}
@apply4to5d {%roll5}{%apply4to5}
@apply4to6 {%compressArgs}{%apply3to6}
@apply4to6d {%roll5}{%apply4to6}
@apply4to7 {%compressArgs}{%apply3to7}
@apply4to7d {%roll5}{%apply4to7}
@apply5to0 {%compressArgs}{%apply4to0}
@roll6 {%.rw}{%roll5}{%.wl}{%swap}
@apply5to0d {%roll6}{%apply5to0}
@apply5to1 {%compressArgs}{%apply4to1}
@apply5to1d {%roll6}{%apply5to1}
@apply5to2 {%compressArgs}{%apply4to2}
@apply5to2d {%roll6}{%apply5to2}
@apply5to3 {%compressArgs}{%apply4to3}
@apply5to3d {%roll6}{%apply5to3}
@apply5to4 {%compressArgs}{%apply4to4}
@apply5to4d {%roll6}{%apply5to4}
@apply5to5 {%compressArgs}{%apply4to5}
@apply5to5d {%roll6}{%apply5to5}
@apply5to6 {%compressArgs}{%apply4to6}
@apply5to6d {%roll6}{%apply5to6}
@apply5to7 {%compressArgs}{%apply4to7}
@apply5to7d {%roll6}{%apply5to7}
@apply6to0 {%compressArgs}{%apply5to0}
@roll7 {%.rw}{%roll6}{%.wl}{%swap}
@apply6to0d {%roll7}{%apply6to0}
@apply6to1 {%compressArgs}{%apply5to1}
@apply6to1d {%roll7}{%apply6to1}
@apply6to2 {%compressArgs}{%apply5to2}
@apply6to2d {%roll7}{%apply6to2}
@apply6to3 {%compressArgs}{%apply5to3}
@apply6to3d {%roll7}{%apply6to3}
@apply6to4 {%compressArgs}{%apply5to4}
@apply6to4d {%roll7}{%apply6to4}
@apply6to5 {%compressArgs}{%apply5to5}
@apply6to5d {%roll7}{%apply6to5}
@apply6to6 {%compressArgs}{%apply5to6}
@apply6to6d {%roll7}{%apply6to6}
@apply6to7 {%compressArgs}{%apply5to7}
@apply6to7d {%roll7}{%apply6to7}
@apply7to0 {%compressArgs}{%apply6to0}
@roll8 {%.rw}{%roll7}{%.wl}{%swap}
@apply7to0d {%roll8}{%apply7to0}
@apply7to1 {%compressArgs}{%apply6to1}
@apply7to1d {%roll8}{%apply7to1}
@apply7to2 {%compressArgs}{%apply6to2}
@apply7to2d {%roll8}{%apply7to2}
@apply7to3 {%compressArgs}{%apply6to3}
@apply7to3d {%roll8}{%apply7to3}
@apply7to4 {%compressArgs}{%apply6to4}
@apply7to4d {%roll8}{%apply7to4}
@apply7to5 {%compressArgs}{%apply6to5}
@apply7to5d {%roll8}{%apply7to5}
@apply7to6 {%compressArgs}{%apply6to6}
@apply7to6d {%roll8}{%apply7to6}
@apply7to7 {%compressArgs}{%apply6to7}
@apply7to7d {%roll8}{%apply7to7}
@applyStoS.stackHand.env rwvvrrwvrrz$wlcwllcc
@applyStoS.std.env {%applyStoS.stackHand.env}
@applyS {%applyStoS.std.env}
@applyd {%swap}{%apply}
@assert rKl
@assert.abc K
@inLd {%.rw}{%inL}{%.wl}
@t.assertBalanced.AATree {%take}[{%put}{%inline}{%inLd}{%inc}]{%block}[{%discard}{%inR}#{%integer}]{%block}{%if}
@inRd {%.rw}{%inR}{%.wl}
@rt.assertBalanced.AATree {%take}[{%put}{%inline}{%inLd}]{%block}[{%put}{%t.assertBalanced.AATree}{%inRd}]{%block}{%if}
@eq {%neq}{%not}
@assertEQ.n {%eq}{%assert}{%x}
@assertEQ1.n {%assertEQ.n}{%drop}
@n.assertBalanced.AATree {%take}{%wx}{%wx}{%paste}{%rt.assertBalanced.AATree}{%rot}{%put}{%t.assertBalanced.AATree}{%swapd}{%assertEQ1.n}{%take}{%p}{%pw}{%put}
@fixpoint#v4 {%.prebind_l}{%.fixfirst}
@fixpoint {%fixpoint#v4}
@r.assertBalanced.AATree [{%n.assertBalanced.AATree}]{%block}{%fixpoint}{%t.assertBalanced.AATree}{%drop}
@assertBalanced.AATree [{%r.assertBalanced.AATree}]{%block}{%apply1to1}
@unseal.rbt r{.rbt}l
@car {%x}{%dup}{%dp}
@cadr {%wx}{%car}{%dpw}
@n.color.rbt {%cadr}
@hapc {%paste}{%inline}
@black.assertBalanced.rbt {%wx}{%wx}{%x}{%hapc}{%rot}{%hap}{%swapd}{%assertEQ1.n}{%inc}{%dpw}{%dpw}{%dpw}
@black.rbt {%intro1}{%inL}
@seal.rbt r{:rbt}l
@seald.rbt {%.rw}{%seal.rbt}{%.wl}
@t.color.rbt {%unseal.rbt}[{%black.rbt}{%inLd}]{%block}[{%n.color.rbt}{%inRd}]{%block}{%if}{%seald.rbt}
@mirror {%not}
@assertInL {%mirror}{%assert}
@assertBlack.rbt {%t.color.rbt}{%assertInL}{%elim1}
@red.assertBalanced.rbt {%wx}{%wx}{%x}{%assertBlack.rbt}{%hapc}{%rot}{%assertBlack.rbt}{%hap}{%swapd}{%assertEQ1.n}{%dpw}{%dpw}{%dpw}
@fst rrw%l
@condSelect_ {%p}{%distrib}r[rwl]{%block}r?FMw%l{%fst}
@if_ {%condSelect_}{%inline}
@n.assertBalanced.rbt {%n.color.rbt}[{%black.assertBalanced.rbt}]{%block}[{%red.assertBalanced.rbt}]{%block}{%if_}
@t.assertBalanced.rbt {%unseal.rbt}[{%discard}{%inL}#{%integer}]{%block}[{%n.assertBalanced.rbt}{%inRd}]{%block}{%if}{%seald.rbt}
@h.assertBalanced.rbt [{%t.assertBalanced.rbt}]{%block}{%take}{%hfix}{%hap}
@assertBalanced.rbt {%h.assertBalanced.rbt}{%drop}
@assertBoolean rVR[{%.assertUnit}]{%block}r?W[{%.assertUnit}]{%block}r?WLCl
@gte {%.gte}
@assertGTE {%gte}{%assert}{%x}
@assertGTEz #{%integer}{%assertGTE}{%drop}
@assertEQz #{%integer}{%assertEQ.n}{%drop}
@assertInteger {%dup}#1{%integer}{%.rem}{%assertEQz}{%drop}
@assertNatural {%assertGTEz}{%assertInteger}
@lt {%.lt}
@assertLT {%lt}{%assert}{%wx}
@assertChar {%assertNatural}#1114112{%integer}{%assertLT}{%drop}
@assertEQ {%pw}rr{&≡}ll{%wx}
@assertEQ1 {%assertEQ}{%drop}
@assertEQ1d {%swapd}{%assertEQ1}{%swap}
@assertEQ1d.n {%swapd}{%assertEQ1.n}{%swap}
@rotd {%.rw}{%rot}{%.wl}
@assertEQ1dd {%rotd}{%assertEQ1}{%unrot}
@assertEQ1dd.n {%rotd}{%assertEQ1.n}{%unrot}
@rolld {%.rw}{%roll}{%.wl}
@unroll {%swap}{%.rw}{%unrot}{%.wl}
@assertEQ1ddd {%rolld}{%assertEQ1}{%unroll}
@assertEQ1ddd.n {%rolld}{%assertEQ1.n}{%unroll}
@assertEmpty.l {%assert}{%inR}
@gt {%.gt}
@assertGT {%gt}{%assert}{%x}
@assertGTz #{%integer}{%assertGT}{%drop}
@assertInR {%assert}
@assertIsolated r{&isolated}l
@lte {%.lte}
@assertLTE {%lte}{%assert}{%wx}
@assertLTEz #{%integer}{%assertLTE}{%drop}
@assertLTz #{%integer}{%assertLT}{%drop}
@assertNEQ.n {%neq}{%assert}[vrwlc]{%block}{%.left}{%merge}{%x}
@assertNEQz #{%integer}{%assertNEQ.n}{%drop}
@assertNatural+ {%assertGTz}{%assertInteger}
@assertNonEmpty.l {%mirror}{%assert}{%inL}
@assertNumber #{%integer}{%.add}
@assertOctet {%assertNatural}#256{%integer}{%assertLT}{%drop}
@assertProb {%assertGTEz}#1{%integer}{%assertLTE}{%drop}
@assertProd {%w}{%w}
@assertPure r{&pure}l
@assertSafe r{&safe}l
@assertSum {%mirror}{%mirror}
@over {%dupd}{%swap}
@zip2 {%dx}{%x}{%swapd}{%p}{%dp}
@jcons.zipRRA.l {%zip2}{%swapd}{%cons.l}{%swap}{%wx}{%roll}{%inline}
@openA.zipRRA.l {%swap}[{%jcons.zipRRA.l}]{%block}[{%inR}{%swap}{%inL}{%roll}{%drop}]{%block}{%if}
@openB.zipRRA.l {%unroll}[{%openA.zipRRA.l}]{%block}[{%inR}{%roll}{%drop}]{%block}{%if}
@inner.zipRRA.l [{%openB.zipRRA.l}]{%block}{%fixpoint}{%inline}
@zipRevRemApp.l [{%inner.zipRRA.l}]{%block}{%apply3to3}
@zipRevRem.l {%empty.l}{%unrot}{%zipRevRemApp.l}
@zipRem.l {%zipRevRem.l}{%rot}{%reverse.l}{%unrot}
@assertTextEQ1 {%over}{%zipRem.l}{%assert}{%elim1}{%assert}{%elim1}[{%wx}{%assertEQ1.n}{%drop}]{%block}{%each.l}
@assertTextEQ1d {%swapd}{%assertTextEQ1}{%swap}
@assertUniform {%assertGTEz}#1{%integer}{%assertLT}{%drop}
@assertUnit r{%.assertFirstUnit}l
@asynch r{&asynch}l
@count.stats {%unseal.stats}{%x}{%copy}{%p}{%seal.stats}{%put}
@sum.stats {%unseal.stats}{%wx}{%x}{%copy}{%p}{%pw}{%seal.stats}{%put}
@averageNZ.stats {%count.stats}{%take}{%sum.stats}{%put}{%.div}
@average.stats {%count.stats}#{%integer}{%gt}[#{%integer}]{%block}[{%averageNZ.stats}]{%block}{%if_}
@doc.CompositionIsFirstPrinciple "Every compositional model consists of a trinity: components, operators, and properties. Compositional operators are algebraically closed; they combine two components into a third component. Compositional properties are invariant or inductive over the operators, i.e. `P(x*y)=F(P(x),'*',P(y))`. To the extent the properties `P` are useful and the function `F` is simple, we can reason about the composite based on the components. A set of components may be domain specific (such as diagrams, documents, sounds, and scene-graphs) or more general purpose (such as functions, arrows, matrices, grammars).
Effective use of composition often requires domain-specific tradeoffs between the three aspects. For example, by limiting what components we talk about (just diagrams) we can achieve more useful properties (e.g. bounding areas, efficient occlusion) and more operators (add, scale, rotate, translate, etc.). It is possible to switch between compositional models primarily by staging them, such that the output of one compositional model is translated to a component in another compositional model.
Composition is useful as a foundation for scalability and modularity. Compositional properties enable developers to reason about components without deep knowledge of the implementation details. Composition operators are also convenient due to their uniformity, i.e. we aren't forced to develop or learn a new ad-hoc language or interface for every object. The uniformity and compositional properties can lead to useful intuitions. In comparison, non-compositional models require an ever deeper knowledge of the dependencies to reason about behavior, and ever more ad-hoc and problem-specific glue code to integrate solutions.
Many models favored in conventional programming practice - including state machines, records, process loops, nominative types, conventional conditional expressions, even parametric abstraction - are not compositional. Fortunately, compositional alternatives are available. Grammars can operate as state machines (via parsing). Datalog or relations can generalize records. Processes can be compositional if we instead model them as partial and incremental (i.e. small-step processes; `µP.a→(P*b)`). Nominative types can be replaced with structural types. If/then/else and ad-hoc pattern-case conditional expressions can be replaced with a structural sum types. Ad-hoc parametric abstraction can often be replaced with staging and a reader monad.
Awelon project strongly favors compositional models and designs. This should be reflected in AO's dictionaries and ontologies. I ask that all AO developers embrace composition as first design principle, pervasively, with priority over most other features.
AO is designed to serve as a relatively generic compositional layer, to enable integration or translation of domain-specific models. AO's words are themselves software components. AO's compositional properties - especially causal commutativity, spatial idempotence, substructural types, and capability security - are very useful in this role. AO is also designed to mitigate common weaknesses of deeply layered abstractions by aggressive use of partial evaluation, dependent type analysis, and program search.
~{%literal}
@step.nub.l {%swap}[{%action.nub.l}]{%block}[{%nip}{%inR}]{%block}{%if}
@nub.l [{%step.nub.l}]{%block}{%fixpoint}{%apply}
@ltb {%.ltb}
@bi* [{%dip}]{%block}{%dip}{%inline}
@bi& {%dup}{%bi*}
@nonEmpty.sortBy.l {%x}{%copy}{%rot}{%bind}{%partitionBy.l}{%swap}{%rot}{%bi&}{%put}{%cons.l}{%append.l}
@step.sortBy.l {%rot}[{%nonEmpty.sortBy.l}]{%block}[{%nip2}{%inR}]{%block}{%if}
@sortBy.l [{%step.sortBy.l}]{%block}{%bind}{%fixpoint}{%apply}
@bench.docmanip1 {%doc.CompositionIsFirstPrinciple}{%nub.l}[{%ltb}]{%block}{%sortBy.l}
@bench.docmanip2 {%doc.CompositionIsFirstPrinciple}[{%ltb}]{%block}{%sortBy.l}{%nub.l}
@drop3 {%drop}{%drop}{%drop}
@step.repeat {%rot}{%dup}#{%integer}{%gt}[{%drop3}]{%block}[{%action.repeat}]{%block}{%if_}
@repeat {%assertNatural}{%.rw}[{%step.repeat}]{%block}{%bind}{%fixpoint}{%.wl}{%swap}{%inline}
@bench.repeat100k #{%integer}[#4{%integer}{%.add}]{%block}#100000{%integer}{%repeat}#400000{%integer}{%assertEQ1.n}
@bench.repeat10M #{%integer}[#4{%integer}{%.add}]{%block}#10000000{%integer}{%repeat}#40000000{%integer}{%assertEQ1.n}
@bench.repeat10k #{%integer}[#4{%integer}{%.add}]{%block}#10000{%integer}{%repeat}#40000{%integer}{%assertEQ1.n}
@bench.repeat1M #{%integer}[#4{%integer}{%.add}]{%block}#1000000{%integer}{%repeat}#4000000{%integer}{%assertEQ1.n}
@bi [{%keep}]{%block}{%dip}{%inline}
@bi.blockFree {%rot}{%dup}{%dp}{%swap}{%rot}{%dip}{%wx}{%inline}
@dup2 {%pw}{%dup}{%dwx}{%wx}
@keep2 {%.rw}{%dup2}{%pw}{%.wl}{%dip}{%wx}
@bi2 [{%keep2}]{%block}{%dip}{%inline}
@bi2* [{%dip2}]{%block}{%dip}{%inline}
@bi2& {%dup}{%bi2*}
@dup3 {%pw}{%pw}{%dup}{%dwx}{%dwx}{%wx}{%wx}
@keep3 {%.rw}{%dup3}{%pw}{%pw}{%.wl}{%dip}{%wx}{%wx}
@bi3 [{%keep3}]{%block}{%dip}{%inline}
@bi3* [{%dip3}]{%block}{%dip}{%inline}
@bi3& {%dup}{%bi3*}
@bicons.unzipReverseAppend.l {%wx}{%swapd}{%cons.l}{%unrot}{%cons.l}{%swap}
@bind2 {%bind}{%bind}
@bind2nd [{%swap}]{%block}{%composel}{%bind}
@bind3 {%bind}{%bind}{%bind}
@bind3rd [{%unrot}]{%block}{%composel}{%bind}
@bind4 {%bind}{%bind}{%bind}{%bind}
@bind4th [{%unroll}]{%block}{%composel}{%bind}
@dupfst {%x}{%dup}{%dp}
@bindK.insertKV.bst {%.rw}{%dupfst}{%.wl}{%.bind}
@bindK.insertKV.rbt {%.rw}{%dupfst}{%.wl}{%.bind}
@bindK.insertKV.t23 {%.rw}{%dupfst}{%.wl}{%.bind}
@mul2 r#2{%integer}r*l
@pushBit.bitListToWord [{%mul2}]{%block}[{%mul2}{%inc}]{%block}{%if_}
@pushBit.bitListToWordK {%wx}{%.rw}{%pushBit.bitListToWord}{%.wl}
@mul2d rw{%mul2}wl
@step.bitListToWordK [{%pushBit.bitListToWordK}]{%block}[{%inR}{%mul2d}]{%block}{%if}
@bitListToWordK #{%integer}{%unrot}[{%step.bitListToWordK}]{%block}{%swap}{%repeat}{%drop}
@bitListToOctet #8{%integer}{%bitListToWordK}
@chr:0 #48{%integer}
@chr:1 #49{%integer}
@bitToChar [{%chr:0}]{%block}[{%chr:1}]{%block}{%if_}
@map.l {%mapReverse.l}{%reverse.l}
@bitListToText [{%bitToChar}]{%block}{%map.l}
@bitListToWord #{%integer}{%swap}[{%pushBit.bitListToWord}]{%block}{%each.l}
@take2 {%take}{%take}
@stopOnCount.forCount.s {%discard2}
@onElem.forCount.s {%wx}{%put}{%dec}{%put2}{%dip3}{%inline}
@empty.s [vvrwlcVVRWLCc]{%block}
@stopOnElem.forCount.s {%elim1}{%empty.s}{%put}{%discard2}
@tryElem.forCount.s {%take}{%intro1}{%.applyd}[{%onElem.forCount.s}]{%block}[{%stopOnElem.forCount.s}]{%block}{%if}
@step.forCount.s {%take2}{%dup}#{%integer}{%gt}[{%stopOnCount.forCount.s}]{%block}[{%tryElem.forCount.s}]{%block}{%if_}
@forCount.s {%assertNatural}{%swap}[{%step.forCount.s}]{%block}{%bind}{%fixpoint}{%inline}
@inner.take.s {%empty.l}{%unrot}[{%cons.l}]{%block}{%swap}{%forCount.s}
@take.s {%inner.take.s}{%drop}{%swap}{%reverse.l}
@step.taking.s {%take.s}[{%inL}{%p}{%inL}]{%block}[{%inR}{%dropd}]{%block}{%if}
@step.fromState.s z$wD[vrwrwz'owlc]{%block}r?VRW[%]{%block}r?WLCc
@fromState.s [{%step.fromState.s}]{%block}{%.bind}{%.fixfirst}{%.bind}
@fromStateE.s {%applyWrap}{%fromState.s}
@taking.s {%assertNatural+}[{%step.taking.s}]{%block}{%bind}{%fromStateE.s}
@fmap.s [{%step.fmap.s}]{%block}{%.bind}{%.fixfirst}{%.bind}
@fmapE.s {%applyWrap}{%fmap.s}
@map.s {%fmapE.s}
@bitStreamToOctetStream #8{%integer}{%taking.s}[{%bitListToOctet}]{%block}{%map.s}
@bitStreamToText [{%bitToChar}]{%block}{%map.s}
@bitStreamToWordKStream {%copy}{%taking.s}{%put}[{%bitListToWordK}]{%block}{%bind}{%map.s}
@n.blackHeight.AATree {%wx}{%x}{%put}{%inline}{%dp}{%dpw}
@t.blackHeight.AATree {%take}[{%n.blackHeight.AATree}{%inLd}{%inc}]{%block}[{%discard}{%inR}#{%integer}]{%block}{%if}
@blackHeight.AATree [{%t.blackHeight.AATree}]{%block}{%fixpoint}{%apply1to2}
@n.blackHeight.rbt {%wx}{%wx}{%x}{%hap}{%dp}{%dpw}{%dpw}{%take}{%n.color.rbt}[{%hsw}{%inc}{%hsw}]{%block}[]{%block}{%if_}{%put}
@t.blackHeight.rbt {%unseal.rbt}[{%discard}{%inL}#{%integer}]{%block}[{%n.blackHeight.rbt}{%inRd}]{%block}{%if}{%seald.rbt}
@blackHeight.rbt [{%t.blackHeight.rbt}]{%block}{%take}{%hfix}{%hap}
@blockToText.io {%drop}"TODO! blockToText.io
~{%literal}
@decd rw{%dec}wl
@body.repeatUntil {%dip2}{%decd}{%inline}
@not.b rVRWLCl
@consd.l {%swap}{%dp}{%inLd}
@part.spanRAP.l {%x}{%put}{%.apply}[{%cons.l}{%discard}]{%block}[{%consd.l}{%put}{%inline}]{%block}{%if}
@open.spanRAP.l {%swap}{%take2}[{%part.spanRAP.l}]{%block}[{%inR}{%discard2}]{%block}{%if}
@spanRevAppP.l {%applyWrap}[{%open.spanRAP.l}]{%block}{%bind}{%fixpoint}{%apply2to2}
@spanRevP.l {%empty.l}{%unrot}{%spanRevAppP.l}{%swap}
@spanP.l {%spanRevP.l}{%reverse.l}
@span.l {%wrapObserver.b}{%spanP.l}
@break.l [{%not.b}]{%block}{%compose}{%span.l}
@breakP.l [{%mirror}]{%block}{%compose}{%spanP.l}
@breakRevP.l [{%not.b}]{%block}{%compose}{%spanRevP.l}
@unroll2 {%swap}
@bury1 {%unroll2}
@unroll2d {%swapd}
@bury1d {%unroll2d}
@unroll3 {%unrot}
@bury2 {%unroll3}
@unrotd {%.rw}{%unrot}{%.wl}
@unroll3d {%unrotd}
@bury2d {%unroll3d}
@unroll4 {%unroll}
@bury3 {%unroll4}
@unrolld {%.rw}{%unroll}{%.wl}
@unroll4d {%unrolld}
@bury3d {%unroll4d}
@unroll5 {%swap}{%.rw}{%unroll4}{%.wl}
@bury4 {%unroll5}
@unroll5d {%.rw}{%unroll5}{%.wl}
@bury4d {%unroll5d}
@unroll6 {%swap}{%.rw}{%unroll5}{%.wl}
@bury5 {%unroll6}
@unroll6d {%.rw}{%unroll6}{%.wl}
@bury5d {%unroll6d}
@unroll7 {%swap}{%.rw}{%unroll6}{%.wl}
@bury6 {%unroll7}
@unroll7d {%.rw}{%unroll7}{%.wl}
@bury6d {%unroll7d}
@unroll8 {%swap}{%.rw}{%unroll7}{%.wl}
@bury7 {%unroll8}
@unroll8d {%.rw}{%unroll8}{%.wl}
@bury7d {%unroll8d}
@unroll9 {%swap}{%.rw}{%unroll8}{%.wl}
@bury8 {%unroll9}
@unroll9d {%.rw}{%unroll9}{%.wl}
@bury8d {%unroll9d}
@c$ [c]{%block}r$
@c.abc c
@c_ vrwlcwlc
@v_ vrwvrwlc
@r_ rrwzlwl
@w_ rwrwzwlwl
@l_ rwrzwll
@c__ {%v_}{%r_}{%w_}{%l_}{%c_}{%w_}{%l_}{%c_}
@v__ {%v_}{%r_}{%w_}{%v_}{%r_}{%w_}{%l_}{%c_}
@z_ {%.rw}{%w_}{%.wl}
@r__ {%r_}{%r_}{%w_}{%z_}{%l_}{%w_}{%l_}
@w__ {%r_}{%w_}{%r_}{%w_}{%z_}{%w_}{%l_}{%w_}{%l_}
@l__ {%r_}{%w_}{%r_}{%z_}{%w_}{%l_}{%l_}
@c___ {%v__}{%r__}{%w__}{%l__}{%c__}{%w__}{%l__}{%c__}
@caar {%x}{%car}{%dp}
@caaar {%x}{%caar}{%dp}
@caaaar {%x}{%caaar}{%dp}
@caaaaar {%x}{%caaaar}{%dp}
@caaaadr {%wx}{%caaaar}{%dpw}
@caaadr {%wx}{%caaar}{%dpw}
@caaadar {%x}{%caaadr}{%dp}
@caaaddr {%wx}{%caaadr}{%dpw}
@caadr {%wx}{%caar}{%dpw}
@caadar {%x}{%caadr}{%dp}
@caadaar {%x}{%caadar}{%dp}
@caadadr {%wx}{%caadar}{%dpw}
@caaddr {%wx}{%caadr}{%dpw}
@caaddar {%x}{%caaddr}{%dp}
@caadddr {%wx}{%caaddr}{%dpw}
@cadar {%x}{%cadr}{%dp}
@cadaar {%x}{%cadar}{%dp}
@cadaaar {%x}{%cadaar}{%dp}
@cadaadr {%wx}{%cadaar}{%dpw}
@cadadr {%wx}{%cadar}{%dpw}
@cadadar {%x}{%cadadr}{%dp}
@cadaddr {%wx}{%cadadr}{%dpw}
@caddr {%wx}{%cadr}{%dpw}
@caddar {%x}{%caddr}{%dp}
@caddaar {%x}{%caddar}{%dp}
@caddadr {%wx}{%caddar}{%dpw}
@cadddr {%wx}{%caddr}{%dpw}
@cadddar {%x}{%cadddr}{%dp}
@caddddr {%wx}{%cadddr}{%dpw}
@cdr {%wx}{%dup}{%dpw}
@cdar {%x}{%cdr}{%dp}
@cdaar {%x}{%cdar}{%dp}
@cdaaar {%x}{%cdaar}{%dp}
@cdaaaar {%x}{%cdaaar}{%dp}
@cdaaadr {%wx}{%cdaaar}{%dpw}
@cdaadr {%wx}{%cdaar}{%dpw}
@cdaadar {%x}{%cdaadr}{%dp}
@cdaaddr {%wx}{%cdaadr}{%dpw}
@cdadr {%wx}{%cdar}{%dpw}
@cdadar {%x}{%cdadr}{%dp}
@cdadaar {%x}{%cdadar}{%dp}
@cdadadr {%wx}{%cdadar}{%dpw}
@cdaddr {%wx}{%cdadr}{%dpw}
@cdaddar {%x}{%cdaddr}{%dp}
@cdadddr {%wx}{%cdaddr}{%dpw}
@cddr {%wx}{%cdr}{%dpw}
@cddar {%x}{%cddr}{%dp}
@cddaar {%x}{%cddar}{%dp}
@cddaaar {%x}{%cddaar}{%dp}
@cddaadr {%wx}{%cddaar}{%dpw}
@cddadr {%wx}{%cddar}{%dpw}
@cddadar {%x}{%cddadr}{%dp}
@cddaddr {%wx}{%cddadr}{%dpw}
@cdddr {%wx}{%cddr}{%dpw}
@cdddar {%x}{%cdddr}{%dp}
@cdddaar {%x}{%cdddar}{%dp}
@cdddadr {%wx}{%cdddar}{%dpw}
@cddddr {%wx}{%cdddr}{%dpw}
@cddddar {%x}{%cddddr}{%dp}
@cdddddr {%wx}{%cddddr}{%dpw}
@cmd.test zwl{%.apply}{%x}rwz
@command.io zwl{%.apply}{%x}rwz
@comp.abc o
@step.fromList.s D[vrwrwz'owlc]{%block}r?VRW[%]{%block}r?WLCc
@fromList.s [{%step.fromList.s}]{%block}{%.fixfirst}{%.bind}
@step.compareStreams {%swap}{%take2}{%intro1}{%.applyd}{%take}{%intro1}{%.applyd}[{%a.compareStreams}]{%block}[{%-a.compareStreams}]{%block}{%if}
@compareStreams [{%step.compareStreams}]{%block}{%bind}{%fixpoint}{%inline}
@compareLists {%take}{%fromList.s}{%take}{%fromList.s}{%put2}{%compareStreams}
@rawCompareNumbers' vrw>[vr>c]{%block}r?Rc
@e.toOrd VRWRW[v%]{%block}r?W[v%]{%block}r?LW[v%]{%block}r?LC
@toOrd\1 v{%e.toOrd}c
@rawCompareNumbers {%rawCompareNumbers'}{%toOrd\1}
@compareNumbers {%pw}[{%rawCompareNumbers}]{%block}{%.apply}
@compareOnStackToRawCompare [{%wx}]{%block}{%composel}{%applyWrap}
@compareProds {%.rw}{%.rw}{%dx}{%x}{%swapd}{%pw}{%dpw}{%.wl}{%.apply}[{%drop}{%.wl}{%.apply}]{%block}[{%inR}{%.wl}{%drop}{%dropd}]{%block}{%if}
@compareSums {%.rw}{%.rw}[{%?l.compareSums}]{%block}[{%?r.compareSums}]{%block}{%if}
@toOrd r{%e.toOrd}l
@compareTexts [{%rawCompareNumbers}]{%block}{%compareLists}{%toOrd}
@compareUnits c{%.inL}
@compile r{&compile}l
@step.compose.p0 vrwrwr$rwzw$zrz'ozw'olc
@compose.p0 [{%step.compose.p0}]{%block}{%.fixfirst}{%.bind}{%.bind}
@composel.p0 {%swap}{%compose.p0}
@cond.eachUntil.l {%swap}{%dip3}{%roll}[{%action.eachUntil.l}]{%block}[{%nip2}{%inL}]{%block}{%if_}
@condSelect {%p}{%distrib}r[rwl]{%block}r?l{%merge}{%x}{%fst}
@fullFactor rFMll{%x}
@condSwap {%p}{%distrib}r[rwl]{%block}r?l{%fullFactor}{%wx}
@condap.abc ?
@cons.s {%p}{%inL}r'[c]{%block}rwol
@constant.s [v^lVc]{%block}{%fromState.s}
@copy.abc ^
@counter.splitReverseN.l {%swap}{%dup}#1{%integer}{%lt}{%swapd}
@nip3 {%.rw}{%drop3}{%.wl}
@step.eachUntil.l {%roll}[{%cond.eachUntil.l}]{%block}[{%nip3}{%inR}]{%block}{%if}
@eachUntil.l [{%step.eachUntil.l}]{%block}{%bind2}{%fixpoint}{%inline}
@inner.splitReverseN.l {%swap}{%empty.l}{%swap}[{%cons.l}{%decd}]{%block}[{%counter.splitReverseN.l}]{%block}{%eachUntil.l}{%swap}{%rot}
@splitReverseN.l {%assertNatural}[{%inner.splitReverseN.l}]{%block}{%apply2to3}
@splitReverse.l {%splitReverseN.l}{%drop}
@copy.l {%splitReverse.l}{%copy}{%reverseAppend.l}{%put}{%reverse.l}
@copy2 {%dup2}{%take2}
@take3 {%take2}{%take}
@copy3 {%dup3}{%take3}
@dup4 {%pw}{%pw}{%pw}{%dup}{%dwx}{%dwx}{%dwx}{%wx}{%wx}{%wx}
@take4 {%take3}{%take}
@copy4 {%dup4}{%take4}
@dup5 {%pw}{%pw}{%pw}{%pw}{%dup}{%dwx}{%dwx}{%dwx}{%dwx}{%wx}{%wx}{%wx}{%wx}
@take5 {%take4}{%take}
@copy5 {%dup5}{%take5}
@dup6 {%pw}{%pw}{%pw}{%pw}{%pw}{%dup}{%dwx}{%dwx}{%dwx}{%dwx}{%dwx}{%wx}{%wx}{%wx}{%wx}{%wx}
@take6 {%take5}{%take}
@copy6 {%dup6}{%take6}
@dup7 {%pw}{%pw}{%pw}{%pw}{%pw}{%pw}{%dup}{%dwx}{%dwx}{%dwx}{%dwx}{%dwx}{%dwx}{%wx}{%wx}{%wx}{%wx}{%wx}{%wx}
@take7 {%take6}{%take}
@copy7 {%dup7}{%take7}
@incd rw{%inc}wl
@state.p0 r[{%preApply}{%wx}]{%block}ro[{%pw}{%postApply}]{%block}rwol{%.state.p0}
@countFrom.p0 [{%drop}{%dup}{%incd}]{%block}{%state.p0}
@count.p0 #1{%integer}{%countFrom.p0}
@counterFrom.p0 [rw{%dup}{%incd}wl{%pw}]{%block}{%state.p0}
@counter.p0 #1{%integer}{%counterFrom.p0}
@curry [{%bind}]{%block}{%bind}
@curry2 [{%bind}{%curry}]{%block}{%bind}
@curry3 [{%bind}{%curry2}]{%block}{%bind}
@curry4 [{%bind}{%curry3}]{%block}{%bind}
@digit.abc rw#10{%integer}r*+
@d0.abc #{%integer}{%digit.abc}
@d1.abc #1{%integer}{%digit.abc}
@d2.abc #2{%integer}{%digit.abc}
@d3.abc #3{%integer}{%digit.abc}
@d4.abc #4{%integer}{%digit.abc}
@d5.abc #5{%integer}{%digit.abc}
@d6.abc #6{%integer}{%digit.abc}
@d7.abc #7{%integer}{%digit.abc}
@d8.abc #8{%integer}{%digit.abc}
@d9.abc #9{%integer}{%digit.abc}
@debugPrintRaw r[{&debug print raw}]{%block}r$l
@debugPrintText r[{&debug print text}]{%block}r$l
@dec\1 v#1-{%integer}r+c
@div2 r#5{%integer}#1{%integer}{%decimal}r*l
@roundToFrac {%dup}rw{%div2}{%.add}wl{%alignToFrac}
@decimal12 #1000000000000{%integer}{%.inv}{%roundToFrac}
@decimal6 #1000000{%integer}{%.inv}{%roundToFrac}
@step.delay.p0 vrwrwz'olc
@delay.p0 [{%step.delay.p0}]{%block}{%.fixfirst}{%.bind}
@destroy.io "destroy
~{%literal}{%p}{%command.io}{%elim1}
@dig1 {%roll2}
@roll2d {%swapd}
@dig1d {%roll2d}
@dig2 {%roll3}
@roll3d {%rotd}
@dig2d {%roll3d}
@dig3 {%roll4}
@roll4d {%rolld}
@dig3d {%roll4d}
@dig4 {%roll5}
@roll5d {%.rw}{%roll5}{%.wl}
@dig4d {%roll5d}
@dig5 {%roll6}
@roll6d {%.rw}{%roll6}{%.wl}
@dig5d {%roll6d}
@dig6 {%roll7}
@roll7d {%.rw}{%roll7}{%.wl}
@dig6d {%roll7d}
@dig7 {%roll8}
@roll8d {%.rw}{%roll8}{%.wl}
@dig7d {%roll8d}
@roll9 {%.rw}{%roll8}{%.wl}{%swap}
@dig8 {%roll9}
@roll9d {%.rw}{%roll9}{%.wl}
@dig8d {%roll9d}
@dip0 {%inline}
@dip1 {%dip}
@dip4 {%dpw}{%dip3}{%wx}
@dip5 {%dpw}{%dip4}{%wx}
@dip6 {%dpw}{%dip5}{%wx}
@dip7 {%dpw}{%dip6}{%wx}
@dip8 {%dpw}{%dip7}{%wx}
@dirLeft.z.rbt {%intro1}{%inL}
@dirRight.z.rbt {%intro1}{%inR}
@discard3 {%hsw}{%drop3}{%hsw}
@drop4 {%drop}{%drop}{%drop}{%drop}
@discard4 {%hsw}{%drop4}{%hsw}
@drop5 {%drop2}{%drop3}
@discard5 {%hsw}{%drop5}{%hsw}
@drop6 {%drop3}{%drop3}
@discard6 {%hsw}{%drop6}{%hsw}
@distrib.abc D
@false.b {%intro1}{%inL}
@trimBoolean r{%trimBoolean\1e}l
@distribInL {%false.b}{%swap}{%distrib}{%trimBoolean}
@distribInLd {%.rw}{%distribInL}{%.wl}
@distribInR {%distribInL}{%mirror}
@distribInRd {%.rw}{%distribInR}{%.wl}
@div2\1 v#5{%integer}#1{%integer}{%decimal}r*c
@div2d rw{%div2}wl
@divMod.abc Q
@divMod\2 vrwQwlc
@div\2 vrw/*c
@l rrwrzwlll
@dl {%.rw}{%l}{%.wl}
@doc.#.abc "e→(N(0)*e); intro number 0
~{%literal}
@doc..abs "N(a) -- N(|a|)
~{%literal}
@doc..add "N(b) N(a) -- N(a+b)
~{%literal}
@doc..addend.s "(a`S*(a`S*e))→(a`S*e); addend streams (ABC layer stack)
~{%literal}
@doc..app1 "[1→y]→y
~{%literal}
@doc..app1e "[1→y]*e → y*e
~{%literal}
@doc..apply1 "[1→y] -- y
~{%literal}
@doc..assertFirstUnit "(1*e)→(1*e); assert first value is unit
~{%literal}
@doc..assertUnit "1→1; assert singular value is unit
~{%literal}
@doc..bapply "[x→x'] -- [((x*s)*e)→((x'*s)*e)]
~{%literal}
@doc..bfirst "[x→x'] -- [(x*y)→(x'*y)]
~{%literal}
@doc..bi "a a (a→b) -- b b
~{%literal}
@doc..bi& "a a [a→b] -- b b; raw 'bi&'
~{%literal}
@doc..bind "x [(x*y)→z] -- [y→z]; bind argument into pair
~{%literal}
@doc..bind2nd "y [(x*y)→z] -- [x→z]; bind second argument in pair
~{%literal}
@doc..bleft "[x→x'] -- [(x+y)→(x'+y)]
~{%literal}
@doc..both "(a*b) [a→a'] [b→b'] -- (a'*b')
~{%literal}
@doc..bright "[y→y'] -- [(x+y)→(x+y')]
~{%literal}
@doc..bsecond "[y→y'] -- [(x*y)→(x*y')]
~{%literal}
@doc..curry "[(x*y)→z] -- [x→[y→z]]; curry pair argument
~{%literal}
@doc..div "N(a) N(b) -- N(a/b)
~{%literal}
@doc..divMod "N(a) N(b) -- N(r) N(q) where a=q*b+r and r in (b,0] or [0,b)
~{%literal}
@doc..either "(a + b) [a→a'] [b→b'] -- (a' + b')
~{%literal}
@doc..eitherBind "(a+b) [(a*e)→e'] [(b*e)→e'] -- ([e→e']+[e→e'])
~{%literal}
@doc..first "(a*b) [a→a'] -- (a'*b)
~{%literal}
@doc..firstfixfirst "([([a→b]*a)→b]*e)→([a→b]*e); a minimal fixpoint
~{%literal}
@doc..fixfirst "[([a→b]*a)→b] -- [a→b]; fixpoint first argument in pair
~{%literal}
@doc..fmap.s "([a → b] * (a`S * e))→(b`S * e); map stream primitive
~{%literal}