forked from urbit/old-urbit.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hoon.txt
8655 lines (8132 loc) · 250 KB
/
hoon.txt
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
:: This is an annotated and reordered version of hoon.hoon. Work in progress.
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::: :::::: Preface ::::::
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
?> ?=(@ .) :: atom subject
%. . :: fun with subject
|= cud=@ :: call it cud
=- ?: =(0 cud) :: if cud is 0
all :: then return engine
(make:all cud) :: else simple compile
^= all :: assemble engine
=~ :: volume stack
%164 :: version constant
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::: :::::: volume 0, version stub ::::::
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
~% %k.164 ~ ~ ::
|% ::
++ stub 164 :: version stub
-- ::
:: The current version of Hoon using Urbit's kelvin versioning system.
:: ~tomsyt-balsen/try=> stub
:: 164
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::: :::::: volume 1, Hoon models ::::::
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
~% %mood
+
~
|% ::
:: ?? Models all use , ($,) or %clam. When you pass a clam a value, it produces
:: something similar to a bunt?
:::::: Atom models
++ axis ,@ :: tree address
:: The tree address described by the Nock specification.
++ bloq ,@ :: blockclass
:: A bare atom most often used in bit manipulation functions for setting the
:: size of block of bits to operate on. ++bloq should always be read as a
:: binary power. For example, a ++bloq of 0 means single bits, whereas a
:: ++bloq of 3 means bytes.
++ numb ,@ :: just a number
:: For commenting programmer intent.
++ pass ,@ :: public key
:: Used by crypto in zuse. Public key.
++ ring ,@ :: private key
:: Used by crypto in zuse. Private key.
++ odor ,@ta :: atom format
:: An atom format.
:: `,@ta`, which itself contains the odor `@ta`, means that an
:: odor produces an atom of ascii text, such as 'ta', which is
:: 24.948.
:::::: String-like models
++ char ,@tD :: UTF-8 byte
:: A UTF-8 text atom a single byte in length; a single character.
++ cord ,@t :: text atom (UTF-8)
:: An atom of text, or a stream of UTF-8 bits mapped to an atom.
:: 'foo' is a cord.
:: ~tomsyt-balsen/try=> `@`'foo'
:: 7.303.014
:: ~tomsyt-balsen/try=> `@ub`'foo'
:: 0b110.1111.0110.1111.0110.0110
++ span ,@ta :: text atom (ASCII)
:: An ASCII text atom. The prefix is `~.`. There are no escape sequences
:: except `~~`, which means `~`, and `~-`, which means `_`. `-` and `.` encode
:: themselves. No other characters besides numbers and lowercase letters are
:: permitted.
:: ~.foo is a span
++ term ,@tas :: Hoon's ASCII subset
:: A subset of ASCII text. The only characters permitted are lowercase ASCII,
:: `-` except as the first or last character, and 0-9 except as the first
:: character.
++ tape (list char) :: list of characters
:: A list of chars. This is roughly equivalent to what in many other languages
:: is called a "string". Hoon, however, has two different models that fill the
:: same role that a "string" does in other languages. The other model is a
:: ++ cord.
:: "foo" is a tape.
:: ~tomsyt-balsen/try=> `(list ,@)`"foo"
:: ~[102 111 111]
:: ~tomsyt-balsen/try=> `@tD`102
:: ~~f
:::::: Time models
++ date ,[[a=? y=@ud] m=@ud t=tarp] :: parsed date
:: A list of a year cell (a loobean head for AD or BC and a year atom), a
:: month atom, and a ++ tarp (a parsed time).
++ tarp ,[d=@ud h=@ud m=@ud s=@ud f=(list ,@ux)] :: parsed time
:: A list of atoms representing, in order, day, hour, minute, second and
:: subsecond. The subsecond is itself a list of atoms.
++ time ,@da :: galactic time
:: An atom that maps to a time.
:: ~2014.2.17..14.47.50..0f86 is a time.
:: ~tomsyt-balsen/try=> `@`~2014.2.17..14.47.50..0f86
:: 170.141.184.500.841.997.869.354.824.985.386.942.464
:: ~tomsyt-balsen/try=> `@da`170.141.184.500.841.997.869.354.824.985.386.942.464
:: ~2014.2.17..14.47.50..0f86
:::::: Parsing models
++ pint ,[p=[p=@ q=@] q=[p=@ q=@]] :: line/column range
:: A cell of two atom pairs. Used for line and column range in a file.
++ dime ,[p=@ta q=@] ::
:: A pair of a text atom and a raw atom.
++ coin $% [%$ p=dime] ::
[%blob p=*] ::
[%many p=(list coin)] ::
== ::
:: A dime (a span atom pair) labeled %$, a noun labeled %blob, and a list of
:: coins (which could be null) labelled many.
:::::: Parsing @ta
++ hapt (list ,@ta) ::
:: A list of spans: like a path.
:: ?? hapt doesn't appear anywhere except here. usage example?
++ hair ,[p=@ud q=@ud] ::
:: A pair of unsigned decimal atoms, like a line column pair.
++ nail ,[p=hair q=tape] ::
:: A pair of a pair of atoms and a tape. Used as an arg for parsing rules
:: ?? parsing? clarify usage example?
++ path (list span) ::
:: A list of spans used to describe a location in a filesystem.
:: /~tomsyt-balsen/try is a path
:: ~tomsyt-balsen/try=> `(list ,@)`/~tomsyt-balsen/try
:: ~[2.239.102.822.615.623.022.927.944.589.735.038 7.959.156]
:: ~tomsyt-balsen/try=> `(list ,term)`/~tomsyt-balsen/try
:: ~[%~tomsyt-balsen %try]
++ wall (list tape) :: text lines
:: A list of ++tapes (list of chars) text lines in a file
++ rule |=(tub=nail `edge`[p.tub ~ ~ tub]) ::
:: A gate that takes a nail and produces and edge.
++ spot ,[p=path q=pint] :: range in file
:: A cell of a path and a pint. Used for a specific spot in a file.
:::::: Uncategorized
++ abel typo :: original sin: type
:: One of four biblical names in hoon. Abel is used for staging/type upgrades.
:: ?? used for macros?
++ also ,[p=term q=wing r=type] :: alias
:: A triple of a term (a text atom), a wing (a list of limbs, or part of a
:: subject) and a type.
:: ?? The term becomes the alias of the wing plus type?
++ base ?([%atom p=odor] %noun %cell %bean %null) :: axils, @ * ^ ? ~
:: ? is $? which is a %fern. ++base is either an odored atom, a noun, a cell,
:: a bean (loobean) or null.
++ beer $|(@ [~ p=twig]) :: string construction
:: $| is a %reed, ++beer is an atom and the cell of null and a twig. string
:: construction.
++ calf ,[p=(map ,@ud wine) q=wine] ::
:: A map of wines to numbers.
++ chum $? lef=term :: jet name
[std=term kel=@] :: kelvin version
[ven=term pro=term kel=@] :: vendor and product
[ven=term pro=term ver=@ kel=@] :: all of the above
== ::
:: $? is a fern. ++chum is either a term called lef; a term called std and an
:: atom kel; a term ven, a term pro, and an atom kel; or a term ven, a term
:: pro, an atom ver and an atom kel.
:: ?? something to do with jets? vendor, version, product, kelvin
++ claw $% [%ash p=twig] :: dry, geometric
[%elm p=twig] :: wet, generic
[%oak ~] :: XX not used
[%yew p=(map term claw)] :: XX not used
== ::
:: $% is a kelp.
:: ?? is the same as a foot?
++ coat ,[p=path q=vase] ::
:: The pair of a path (a list of spans) and a vase (a type noun pair).
++ coil $: p=?(%gold %iron %lead %zinc) :: %metl, variance
q=type ::
r=[p=?(~ ^) q=(map term foot)] ::
== ::
:: $: is the tile autocons, ? is a %fern. the head of a coil is a metl, q is a
:: type.
:: ?? if tile autocon ($:) takes p and q, what is r for?
++ dram $% [| p=(map ,@tas dram)] ::
[& p=@ud q=@] ::
== ::
:: $% is a kelp. A map of drams to terms or a pair of a @ud and a raw atom
:: ?? simple directory for unix
++ each |*([a=$+(* *) b=$+(* *)] $%([& p=a] [| p=b])) ::
:: effectively a macro
:: !! this needs work. expand to wide form to help?
++ edge ,[p=hair q=(unit ,[p=* q=nail])] ::
:: an edge is a pair of a hair (pair of decimals) and a unit of a noun and a
:: nail pair.
:: ?? parsing? examples.
++ foot $% [%ash p=twig] :: dry, geometric
[%elm p=twig] :: wet, generic
[%oak ~] :: XX not used
[%yew p=(map term foot)] :: XX not used
== ::
:: $% is a kelp. wet elm, dry ash, null, labeled? oak and yew for inheritance,
:: ignore
:: ?? This needs an explanation of the difference between wet and dry
++ gear |* a=_,* :: list generator
$_ ::
=| b=* ::
|? ::
?@ b ::
~ ::
[i=(a -.b) t=^?(..$(b +.b))] ::
:: Gears are not currently used.
++ like |* a=_,* :: generic edge
|= b=_`*`[(hair) ~] ::
:- p=(hair -.b) ::
^= q ::
?@ +.b ~ ::
:- ~ ::
u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]] ::
:: ?? edge producing x
:: !!
++ limb $|(term $%([%& p=axis] [%| p=@ud q=term])) ::
:: $| is a %reed. ++limb is a term and an axis or a term and a unsigned
:: decimal. This is how values are addressed in wings.
++ line ,[p=[%leaf p=odor q=@] q=tile] :: kelp case labels
:: Used by a kelp, its head is a %leaf, which reduces to a %cube label for the
:: tile in the tail.
++ list |* a=_,* :: null-terminated list
$|(~ [i=a t=(list a)]) ::
:: A nested structure that terminates with ~.
:: ~dovryp-toblug/try=> ((list ,@u) [1 2 3 ~])
:: ~[1 2 3]
++ metl ?(%gold %iron %zinc %lead) :: core variance
:: Any one of four labels describing core variance.
++ tree |* a=_,* :: binary tree
$|(~ [n=a l=(tree a) r=(tree a)]) ::
:: A simple binary tree. node is n, l is left, r is right. ~ terminates. Maps,
:: Sets and Queues are all trees.
:: n
:: l r
++ port $: p=axis ::
$= q ::
$% [%& p=type] ::
[%| p=axis q=(list ,[p=type q=foot])] ::
== ::
== ::
:: [axis [%bark q [%kelp [%.y type] [%.n axis (list ,[type foot])]]]]
:: !! in english! used in flay, foil, ~(fink ut), ~(seek ut)
++ post $: p=axis ::
$= q ::
$% [0 p=type] ::
[1 p=axis q=(list ,[p=type q=foot])] ::
[2 p=twin q=type] ::
== ::
== ::
:: !!
++ prop $: p=axis ::
$= q ::
[p=?(~ axis) q=(list ,[p=type q=foot])] ::
== ::
:: !!
++ reef ,[p=[p=? q=@ud] q=@ud] ::
:: Pair of a loobean and a decimal with another decimal.
++ shoe $% [%hunk p=tank] ::
[%lose p=term] ::
[%mean p=*] ::
[%spot p=spot] ::
== ::
:: Four cases: a tank, a term, a noun or a spot
++ tank $% [%leaf p=tape] :: printing formats
[%palm p=[p=tape q=tape r=tape s=tape] q=(list tank)]
[%rose p=[p=tape q=tape r=tape] q=(list tank)]
== ::
:: $% is a kelp. ++tank has three cases, a leaf, a palm and a rose. ++tank
:: is for printing: %palm is backstep, %rose is straight down.
:: ?? are these just different dimensions of nested tapes? palm is 4d, rose is
:: 3d?
++ tiki :: test case
$% [& p=(unit term) q=wing] :: simple wing
[| p=(unit term) q=twig] :: named wing
== ::
:: $% is a kelp. ++tiki has two cases, a unit term and a wing if yes, or a
:: unit term and a twig if no. Used for name resolution.
:: ?? since & (?&) computes the and of two loobeans, are the unit and term in
:: p converted somehow? how are they tested against q? same for | (?|)
++ tile $& [p=tile q=tile] :: ordered pair
$% [%axil p=base] :: base type
[%bark p=term q=tile] :: name
[%bush p=tile q=tile] :: pair/tag
[%fern p=[i=tile t=(list tile)]] :: plain selection
[%herb p=twig] :: gate
[%kelp p=[i=line t=(list line)]] :: tag selection
[%leaf p=term q=@] :: constant atom
[%reed p=tile q=tile] :: atom/cell
[%weed p=twig] :: example
== ::
:: A convenient mechanism for making well-typed nouns.
:: An axil is an icon for an odored atom, a noun, a cell, a bean or null.
:: %bark wraps a term around a tile.
:: %bush is tile with an cellular head p or an atomic head q.
:: %fern is a non-empty list of cases, must be orthogonal
:: %herb is a twig, used as a tile
:: %kelp is a tagged union, a list of cases and labels
:: %leaf is an atomic constant
:: %reed is atoms of p=tile and cells of q=tile
:: %weed is a tile by default value, same as bunting a twig
++ toga :: face control
$| p=term :: two togas
$% [0 ~] :: no toga
[1 p=term q=toga] :: deep toga
[2 p=toga q=toga] :: cell toga
== ::
:: A term and one of three cases: null, a term and a ++toga, or a ++toga pair.
:: Wraps a whole tree with faces
++ twig $& [p=twig q=twig] ::
$% ::
[%$ p=axis] :: blip, empty name
:: :::::: tile reductions:
[%bccb p=tile] :: bunted tile
[%bccm p=tile] :: validator gate
[%bcpt p=wing q=tile] :: whips p into q
[%bctr p=tile] :: static bunt w/ ^~
[%bczp p=base] :: bunt an axil
:: :::::: cores
[%brcb p=tile q=(map term foot)] :: %gold tray, sample p
[%brcn p=(map term foot)] :: %gold core
[%brdt p=twig] :: dry %gold trap
[%brfs p=tile q=(map term foot)] :: vulcan. %gold tray
[%brkt p=twig q=(map term foot)] :: %gold book
[%brhp p=twig] :: kick dry %gold trap
[%brls p=tile q=twig] :: dry %iron gate
[%brpt p=tile q=tile r=twig] :: XX not used XX
[%brtr p=tile q=twig] :: vulcan. wet gate
[%brts p=tile q=twig] :: dry %gold gate
[%brwt p=twig] :: dry %lead trap
:: :::::: tuples
[%clcb p=twig q=twig] :: [q p]
[%clcn p=tusk] :: [[p ~] ~]
[%clfs p=twig] :: [%$ [%$ p ~] ~]
[%clkt p=twig q=twig r=twig s=twig] :: [p q r s]
[%clhp p=twig q=twig] :: [p q]
[%clls p=twig q=twig r=twig] :: [p q r]
[%clsg p=tusk] :: [p ~]
[%cltr p=tusk] :: p as a tuple
[%clzz p=tusk] :: macro for :~, :*
:: :::::: invocations
[%cncb p=wing q=tram] :: %=, then cast to p
[%cncl p=twig q=twig] :: pull $.p w/ sample q
[%cndt p=twig q=twig] :: %-(q p)
[%cnhp p=twig q=tusk] :: slam p w/ sample q
[%cntr p=wing q=twig r=tram] :: ??
[%cnkt p=twig q=twig r=twig s=twig] :: slam p w/ %*(q r s)
[%cnls p=twig q=twig r=twig] :: ??
[%cnsg p=wing q=twig r=twig] :: pull p from q with r
[%cnts p=wing q=tram] :: eval. p w/ q changes
[%cnzy p=term] :: pulls limb p
[%cnzz p=wing] :: pulls p
:: :::::: nock
[%dtkt p=twig] :: Nock 11 data skyhook
[%dtls p=twig] :: Nock 4 increment
[%dtzy p=term q=@] :: atom constant
[%dtzz p=term q=*] :: cubed noun constant
[%dttr p=twig q=twig] :: nock p w/ formula q
[%dtts p=twig q=twig] :: Nock 5 equality test
[%dtwt p=twig] :: Nock 3 cell test
:: :::::: prettyprinter
[%hxgl p=tusk] :: slam noah w/ !>:*(p)
[%hxgr p=tusk] :: slam cain w/ !>:*(p)
:: :::::: type conversion
[%ktbr p=twig] :: %gold core to %iron
[%ktdt p=twig q=twig] :: cast q to type (p q)
[%ktls p=twig q=twig] :: cast q to p, verify
[%kthp p=tile q=twig] :: cast q to icon of p
[%ktpm p=twig] :: %gold core to %zinc
[%ktsg p=twig] :: p as static constant
[%ktts p=toga q=twig] :: wrap q in toga p
[%ktwt p=twig] :: %gold core to %lead
:: :::::: hints
[%sgbr p=twig q=twig] :: print p if q fails
[%sgcb p=twig q=twig] :: put p in q's trace
[%sgcn p=chum q=twig r=tyre s=twig] :: id a core for jets
[%sgfs p=chum q=twig] :: jetted arm in a ~%
[%sggl p=$|(term [p=term q=twig]) q=twig] :: hint p to product q
[%sggr p=$|(term [p=term q=twig]) q=twig] :: hint p to q
[%sgbc p=term q=twig] :: label q, profiling
[%sgls p=@ q=twig] :: cache/memoize
[%sgpm p=@ud q=twig r=twig] :: print q w/ priority
[%sgts p=twig q=twig] :: avoid duplication
[%sgwt p=@ud q=twig r=twig s=twig] :: hint iff q is yes
[%sgzp p=twig q=twig] :: type in stacktrace
:: :::::: miscellaneous
[%smcl p=twig q=tusk] :: binary to n-ary
[%smdt p=twig q=tusk] :: ??
[%smdq p=(list beer)] :: assemble string
[%smsg p=twig q=tusk] :: gonads
[%smsm p=twig q=twig] :: make sure q is a p
:: :::::: compositions
[%tsbr p=tile q=twig] :: push bunt: =+(_p q)
[%tscl p=tram q=twig] :: apply p to .. to q
[%tscn p=twig q=twig] :: XX not used
[%tsdt p=wing q=twig r=twig] :: r with p set to q
[%tsfs p=twig q=twig] :: XX not used
[%tsgl p=twig q=twig] :: =>(q p)
[%tshp p=twig q=twig] :: flip push: =+(q p)
[%tsgr p=twig q=twig] :: use p as subj of q
[%tskt p=twig q=twig r=twig s=twig] :: state machine wing
[%tsls p=twig q=twig] :: push p on subj of q
[%tspm p=tile q=twig] :: XX not used
[%tspt p=tile q=twig] :: XX not used
[%tstr p=term q=wing r=twig] :: make a %bull/alias
[%tssg p=tusk] :: compose twig list
:: :::::: conditionals
[%wtbr p=tusk] :: logical OR
[%wthp p=wing q=tine] :: select case in q
[%wthz p=tiki q=tine] :: tiki %wthp
[%wtcl p=twig q=twig r=twig] :: if p, then q, else r
[%wtdt p=twig q=twig r=twig] :: unless, ?:(p r q)
[%wtkt p=wing q=twig r=twig] :: if p is not bunt
[%wtkz p=tiki q=twig r=twig] :: tiki %wtkt
[%wtgl p=twig q=twig] :: assert |, ?:(p !! q)
[%wtgr p=twig q=twig] :: assert &, ?:(p q !!)
[%wtls p=wing q=twig r=tine] :: %wtls with default
[%wtlz p=tiki q=twig r=tine] :: tiki %wtls
[%wtpm p=tusk] :: logical AND
[%wtpt p=wing q=twig r=twig] :: if p is an atom
[%wtpz p=tiki q=twig r=twig] :: tiki %wtpt
[%wtsg p=wing q=twig r=twig] :: null-test if =(p ~)
[%wtsz p=tiki q=twig r=twig] :: tiki %wtsg
[%wtts p=tile q=wing] :: if q is in tile p
[%wtzp p=twig] :: logical NOT
:: :::::: special
[%zpcb p=spot q=twig] :: debug info in trace
[%zpcm p=twig q=twig] :: ??
[%zpcn ~] :: ??
[%zpfs p=twig] :: report subj as err.
[%zpgr p=twig] :: vase w/ value p
[%zpsm p=twig q=twig] :: [type noun] pair
[%zpts p=twig] :: Nock formula of p
[%zpwt p=$|(p=@ [p=@ q=@]) q=twig] :: restrict hoon vers.
[%zpzp ~] :: always crash
==
:: a twig is an abstract syntax tree
:: %bccb produces a bunted tile
:: %bccm produces a validator gate (%clam) for the tile
:: %bcpt is a natural rune that %whips wing p into tile q
:: %bctr produces the %bunt for tile p
:: %bczp bunts an %axil (see ++tile) p
:: %brcb produces a %gold tray with tile sample p
:: %brcn is a natural rune that produces a %gold core
:: %brdt produces a dry %gold trap
:: %brfs produces a vulcanized %gold tray
:: %brkt produces a %gold book
:: %brhp produces a dry %gold trap, kicks it
:: %brls produces a dry %iron gate
:: %brpt is not used
:: %brtr produces a vulcanized wet gate
:: %brts produces a dry %gold gate
:: %brwt produces a dry %lead trap
:: %clcb produces cell [q p]
:: %clcn produces cell [[p ~] ~] from a tusk
:: %clfs produces cell [%$ [%$ p ~] ~]
:: %clkt produces cell [p q r s]
:: %clhp produces cell [p q]
:: %clls produces cell [p q r]
:: %clsg produces a null-terminated tuple
:: %cltr produces a tuple
:: %clzz
:: ??
:: %cncb evaluates p with changes in q, casts back to p
:: %cncl pulls %$ from tray p with sample q
:: %cndt reversed %cnhp
:: ?? shouldn't p be a tusk?
:: %cnhp slams gate p with q
:: %cntr
:: ?? doc doesn't match. looks like it applies all the [wing twig] pairs :: in r to q
:: %cnkt slams gate p with %cntr q r s
:: %cnls uses %cnhp p q r
:: ?? doc doesn't match, and %cnhp takes only two args
:: %cnsg pulls p from tray q with sample r
:: ?? why isnt q's type a tray?
:: %cnts evaluates p with changes in the tram q
:: %cnzy pulls limb p from the subject
:: %dtkt is a natural rune that grabs data from the sky
:: ?? very unclear
:: %dtls is a natural rune that increments an atom
:: %dtzy is a natural rune that produces a non-cubed atomic constant of :: odor p and value q
:: %dtzz is a natural rune that produces a cubed noun constant of odor p :: and value q if q is an atom. if q is a cell produces q.
:: %dttr is a natural rune that calculates nock of subject p, formula q
:: %dtts is a natural rune that tests if two twigs are equal
:: %dtwt is a natural rune that tests whether atom or cells
:: %hxgl slams the gate ++noah with !>:*(p)
:: %hxgr slams the gate ++cain with !>:*(p)
:: %ktbr is a natural rune that converts %gold to %iron
:: %ktdt casts q to type (p q)
:: %ktls is a natural rule that casts q to p, verifying that p contains q
:: %kthp casts q to the icon of p
:: %ktpm converts %gold to %zinc
:: %ktsg tries to execute p statically at compile time, if it fails p :: :: remains dynamic
:: %ktts is a natural rune that wraps q in toga p
:: %ktwt converts a %cold core p to %lead
:: %sgbr prints p if q crashes
:: %sgcb inserts p (a trap producing a tank) in the trace of q
:: %sgcn ids a core p (in parent r) for optimization with a @tas s
:: ?? what is q for?
:: %sgfs flags a core for jet propulsion. p is an arbitrary @tas for a :: jet and q is a core inside of a book.
:: %sggl applies hint p to product of q
:: %sggr is a natural rune that applies hint p to q
:: %sgbc labels q as p for profiling
:: %sgls hints to the interpreter to cache/memoize the product of p
:: %sgpm prints hint q before computing r with log priority p
:: %sgts hints to interpreter that q may produce a noun equal to p to :: :: avoid duplication
:: %sgwt prints hint [%sgpm p r s] iff q is yes
:: %sgzp is a natural hoon that prints the type of p if q fails to compute
:: %smcl applies a binary gate p to an n-ary tuple q
:: %smdt
:: ?? undocumened, with a complicated expansion
:: %smdq assembles a ++beer (string) p
:: %smsg
:: ?? something related to gonads
:: %smsm makes sure q is a p, and is the same as ++hard
:: %tsbr pushes the bunt of p on to the subject and sends it to q
:: %tscl modifies the subject with p and sends it to q
:: %tscn is not used
:: %tsdt produces r with p in the subject set to q
:: %tsfs is not used
:: %tsgl uses the product of p as the subject for q
:: %tshp pushes q on the subject and sends it to p
:: %tsgr is a natural rune that uses the product of p as the subject of q
:: %tskt is for state machines.
:: ?? its unclear from the doc which argument is which
:: %tsls pushes p on the subject and sends it to q
:: %tspm is not used
:: %tspt is not used
:: %tstr creates a ++bull or alias type
:: %tssg creates a list of twigs
:: %wtbr logical or of two loobeans
:: %wthp selects a case in q for the actual type of p
:: ?? not sure exactly what 'actual type' really means
:: %wthz inverse of %wthp
:: %wtcl p produces a loobean. if %.y then q if %.n then r
:: %wtdt p produces a loobean. if %.n then q if %.y then r
:: %wtkt if p is not equal to the bunt of its tile then q, else r
:: %wtkz inverse of %wtkt
:: %wtgl asserts that p is no and evaluates q
:: %wtgr asserts taht p is yes and evaluates q
:: %wtls %wthp with a default case
:: %wtlz
:: ?? not sure i understand tikis. docs are the same for all of these.
:: %wtpm computes the and of the loobeans in p
:: %wtpt if p is an atom produce q else produce r
:: %wtpz inverse of %wtpt
:: %wtsg if p is ~ produce q else produce r
:: %wtsz inverse of wtsg
:: %wtts produces true if the leg in wing q is in the tile p
:: %wtzp logical not of p
++ tine (list ,[p=tile q=twig]) ::
:: A list of tile twig pairs
++ tusk (list twig) ::
:: A list of twigs
++ tyre (list ,[p=term q=twig]) ::
:: A list of term twig pairs
++ tyke (list (unit twig)) ::
:: A list of unit twig pairs
++ tram (list ,[p=wing q=twig]) ::
:: A list of wing twig pairs
++ tone $% [%0 p=*] ::
[%1 p=(list)] ::
[%2 p=(list ,[@ta *])] ::
== ::
:: Three cases: a noun a, a list, and a list of span noun pairs
:::::: virtual nock
++ nock $& [p=nock q=nock] :: autocons
$% [%0 p=@] :: axis select
[%1 p=*] :: constant
[%2 p=nock q=nock] :: compose
[%3 p=nock] :: cell test
[%4 p=nock] :: increment
[%5 p=nock q=nock] :: equality test
[%6 p=nock q=nock r=nock] :: if, then, else
[%7 p=nock q=nock] :: serial compose
[%8 p=nock q=nock] :: push onto subject
[%9 p=@ q=nock] :: select arm and fire
[%10 p=?(@ [p=@ q=nock]) q=nock] :: hint
[%11 p=nock] :: grab data from sky
== ::
:: this one goes to 11.
:: ?? mock nock? these look like nock models.
++ toon $% [%0 p=*] ::
[%1 p=(list)] ::
[%2 p=(list tank)] ::
== ::
:: A noun, a list, or a list of tanks
++ tune $% [%0 p=vase] ::
[%1 p=(list)] ::
[%2 p=(list ,[@ta *])] ::
== ::
:: A vase, a list or a list of span noun pairs
++ twin ,[p=term q=wing r=axis s=type] :: %bull
:: A term, a wing, an axis and a type
++ type $| ?(%noun %void) :: set all or set none
$% [%atom p=term] :: number and format
[%bull p=twin q=type] :: wing synonym
[%cell p=type q=type] :: ordered pair
[%core p=type q=coil] ::
[%cube p=* q=type] :: constants
[%face p=term q=type] :: named type
[%fork p=type q=type] :: union/branch
[%hold p=(list ,[p=type q=twig])] :: infinite generator
== ::
:: A type is either a noun or void that resolves to:
:: %atom is an atom
:: %bull is a twin (a wing an axis and a type) and a type
:: %cell is a type and a type
:: %core is a type and a coil
:: %cube is a noun and a type
:: %face is a term (,@tas) and a type
:: %fork is a type and a type
:: ?? what's the difference between a cell and a fork?
:: %hold is a list of type twig cells
:: [%reed [%fern %noun %void] [cases...]]
++ typo type :: old type
:: ?? Alias?
:::::: Diff architecture
++ udal :: atomic change (%b)
$: p=@ud :: blockwidth
q=(list ,[p=@ud q=(unit ,[p=@ q=@])]) :: indels
== ::
:: An unsigned decimal and a list the pair of a @ud and a unit atom pair
++ udon :: abstract delta
$: p=umph :: preprocessor
$= q :: patch
$% [%a p=ulna] :: trivial replace
[%b p=udal] :: atomic indel
[%c p=(urge)] :: list indel
[%d p=upas q=upas] :: tree edit
== ::
== ::
:: insertions and deletes
:: ?? Looks to be used by the diffs. Needs further explanation.
++ ulna ,[p=* q=*] :: from to
:: A pair of nouns
++ umph :: change filter
$| $? %a :: no filter
%b :: jamfile
%c :: LF text
== ::
$% [%d p=@ud] :: blocklist
== ::
:: $| produces a %reed ([%reed p=tile q=tile])
:: ?? does the $? then return two cases? or is the second case returned by $%
:: (always a @ud)?
++ unce |* a=_,* :: change part
$%([%& p=@ud] [%| p=(list a) q=(list a)]) ::
:: ??
++ unit |* a=_,* :: maybe
$|(~ [~ u=a]) ::
:: Takes a noun and is either a null or the cell [~ noun]
++ upas :: tree change (%d)
$& [p=upas q=upas] :: cell
$% [%0 p=axis] :: copy old
[%1 p=*] :: insert new
[%2 p=axis q=udon] :: mutate!
== ::
:: ?? Used in diffs / merging?
++ urge |*(a=_,* (list (unce a))) :: list change
:: ?? Basically a list of unce, document unce first.
++ vase ,[p=type q=*] :: type-value pair
:: A type and noun
++ vise ,[p=typo q=*] :: old vase
:: A vase, except used for staging
++ wing (list limb) :: part of subject
:: A list of limbs. This is how we get stuff inside our subject!
++ wine $| ?(%noun %path %tank %void %wall %wool %yarn)
$% [%atom p=term] ::
[%core p=(list ,@ta) q=wine] ::
[%face p=term q=wine] ::
[%list p=term q=wine] ::
[%pear p=term q=@] ::
[%pick p=(list wine)] ::
[%plot p=(list wine)] ::
[%stop p=@ud] ::
[%tree p=term q=wine] ::
[%unit p=term q=wine] ::
== ::
:: A list of cubes, the first of which are types, the remainder of which look
:: to be used for building trees of wines.
:: ?? what's a %wool or a yarn?
:: ?? types to print.
++ woof (list $|(@ud [p=@ud q=@ud])) :: udon transform
:: ?? a list of reeds (that produce cells)? Probably for diffs.
++ wonk |*(veq=edge ?@(q.veq !! p.u.q.veq)) ::
:: Takes an edge. Crashes if the q.edge (the unit) inside is an atom, produces
:: p.u.q.edge if not
++ map |* [a=_,* b=_,*] :: associative array
$|(~ [n=[p=a q=b] l=(map a b) r=(map a b)]) ::
:: A map is a tree of [p=* q=*] cells where n is the node, and l and r are
:: branches. Similar to ++tree.
++ qeu |* a=_,* :: queue type
$|(~ [n=a l=(qeu a) r=(qeu a)]) ::
:: A qeu is a tree, but is inteded for use in the queue engine, ++to.
++ set |* a=_,* :: set type
$|(~ [n=a l=(set a) r=(set a)]) ::
:: A set is a tree, but is intended for use in the set engine, ++in.
-- ::
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::: :::::: volume 2, Hoon libraries and compiler ::::::
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
~% %hoon
+
==
%al al :: tile expansion
%ap ap :: twig expansion
%ut ut :: compiler
%seed seed
%show show
==
|%
::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
:::: chapter 2a, basic unsigned math ::::
:: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:::::: Arithmetic
++ dec :: decrement
~/ %dec
|= a=@
~| %decrement-underflow
?< =(0 a)
=+ b=0
|- ^- @
?: =(a +(b))
b
$(b +(b))
:: Decrement atom a by counting up to a-1, return %decrement-underflow if
:: result is less than 0
++ add :: add
~/ %add
|= [a=@ b=@]
^- @
?: =(0 a)
b
$(a (dec a), b +(b))
:: Add atoms a and b by counting down a to zero and incrementing b. Produce b.