@@ -1,126 +1,84 @@
1+---
2+sort: 1
3+---
4+
15Runes
26=====
37
4−In Hoon there are no reserved words. Instead, [`++twigs`]() (abstract
5−syntax trees), are formed using a diagraph of two ASCII symbols, which
6−is called a rune.
7−
8−Runes are loosely divided into categories by their first character. To
9−find documentation on each individual category, follow these links:
10−
11−<list></list>
12−
13−------------------------------------------------------------------------
14−
15−Introduction
16−------------
17−
18−For example, the rune `?:`, pronounced "wutcol", is a rune that accepts
19−three `++twig` expressions to form an "if-then-else statement," where
20−`p` is the predicate, `q` is the "then" statement, and `r` is the "else"
21−statement:
22−
23− [%wtcl p=twig q=twig r=twig]
24−
25−In a program, it is used like so:
26−
27− ++ add
28− |= [a=@ b=@]
29− ^- @
30− ?: =(0 a) b
31− $(a (dec a), b +(b))
32−
33−Here the `=(0 a)` is `p`, the `b` is `q`, and the bottom line is the
34−`r`.
35−
36−There are several benefits to using runes in lieu of reserved words.
37−First, it prevents the programmer from accidentally misusing a reserved
38−word as a variable name, which also allows her to be sure that any word
39−in her progam is an identifier. Next, as the first ASCII symbol of the
40−rune digraphs bears semantic significance, the programmer can look at
41−any rune and immediately have a basic, intuitive understanding as to
42−what it does.
43−
44−Next, rune syntax addresses several issues that arise in other
45−languages. First, it produces cleaner, less verbose code that
46−conveniently flows downward. To highlight the verbosity Hoon avoids by
47−implementing runes, here is the C equivalent of the `++add` source code
48−printed above:
49−
50− attribute add {
51− function(left-operand: atom, right-operand: atom)
52− produce atom
53− if equals(0, left-operand) {
54− right-operand
55− } else {
56− recurse(left-operand (decrement left-operand)),
57− right-operand (increment right-operand))
58− }
59− }
60−
61−What is more, Hoon solves two problems that arise in functional
62−programming languages with very deep expression trees: first, the
63−collection of huge piles of closing parens at the end of large blocks;
64−and second, the fact that the depth of expression trees are thus bounded
65−by the width of the text box, as subexpressions tend to be indented.
66−Some languages solve the bracket-terminator problem by parsing
67−whitespace in order to use indentation to express tree depth:
68−
69− ?:
70− &
71− 47
72− 52
73−
74−While this is actually valid Hoon, it does not solve the width problem.
75−
76−To address this problem, most Hoon `++twigs` have a short, fixed
77−fan-out. Thus, the parser does not need significant whitespace nor a
78−terminator to determine how many twigs follow a `?:`--it already knows
79−that the answer is three. A smart parser allows the Hoon programmer to
80−format her code using a [backstep pattern]() that allows her to descend
81−into a deep tree without losing right margin.
82−
83−Lastly, but perhaps most significantly, code is meant to be seen, and
84−not read. Anyone who has even slight experience coding Hoon will tell
85−you that they can understand and connect with properly formatted Hoon
86−code on a deeper, more intuitive level that cannot be explained but must
87−be experienced. One doesn't read `++add`, she sees it.
88−
89−Names and Categories
90−--------------------
91−
92−While the second glyph in a rune means little or nothing, the first
93−defines a rough semantic category:
94−
95− | bar Core construction
96− $ buc Tile construction
97− % cen Invocations
98− : col Tuple construction
99− . dot Nock operations
100− # hax Pretty printing
101− ^ ket Type conversions
102− ; sem Composers (and XML generators)
103− ~ sig Hints
104− = tis Subject modifiers
105− ? wut Conditionals, booleans, and tests
106− ! zap Special operations
107−
108−As shown above, each glyph has its own monosyllabic name, designed to be
109−pronounced quickly in combination with another glyph to form a rune
110−name. As languages are often read-aloud, this saves the programmer from
111−having to say "dollar sign, question mark"--"bucwut" is much more
112−compact.
113−
114−Irregular pronuncations
115−-----------------------
116−
117−To avoid a few tongue-twisters, some runes have irregular pronunciations
118−that should be noted:
119−
120− -- hephep phep
121− +- lushep slep
122− ++ luslus slus
123− == tistis stet
124−
125−Note: these runes are not members of any of the categories above, but
126−are mostly used to....
8+#### Hoon has no reserved words. Instead we use ASCII pairs we call runes.
9+
10+#### This is the complete index.
11+
12+<div class="book">
13+
14+## `$ buc` (molds)
15+
16+<list dataPath="docs/system/hoon/runes/bc" dataPreview="true" className="runes" childIsFragment="true"></list>
17+
18+---
19+
20+## `| bar` (cores)
21+
22+<list dataPath="docs/system/hoon/runes/br" dataPreview="true" className="runes" childIsFragment="true"></list>
23+
24+---
25+
26+## `: col` (tuples)
27+
28+<list dataPath="docs/system/hoon/runes/cl" dataPreview="true" className="runes" childIsFragment="true"></list>
29+
30+---
31+
32+## `% cen` (invocations)
33+
34+<list dataPath="docs/system/hoon/runes/cn" dataPreview="true" className="runes" childIsFragment="true"></list>
35+
36+---
37+
38+## `. dot` (nock)
39+
40+<list dataPath="docs/system/hoon/runes/dt" dataPreview="true" className="runes" childIsFragment="true"></list>
41+
42+---
43+
44+## `# hax` (printing)
45+
46+<list dataPath="docs/system/hoon/runes/hx" dataPreview="true" className="runes" childIsFragment="true"></list>
47+
48+---
49+
50+## `^ ket` (casting)
51+
52+<list dataPath="docs/system/hoon/runes/kt" dataPreview="true" className="runes" childIsFragment="true"></list>
53+
54+---
55+
56+## `~ sig` (hints)
57+
58+<list dataPath="docs/system/hoon/runes/sg" dataPreview="true" className="runes" childIsFragment="true"></list>
59+
60+---
61+
62+## `; sem` (composition)
63+
64+<list dataPath="docs/system/hoon/runes/sm" dataPreview="true" className="runes" childIsFragment="true"></list>
65+
66+---
67+
68+## `= tis` (subject modifiers)
69+
70+<list dataPath="docs/system/hoon/runes/ts" dataPreview="true" className="runes" childIsFragment="true"></list>
71+
72+---
73+
74+## `? wut` (conditional)
75+
76+<list dataPath="docs/system/hoon/runes/wt" dataPreview="true" className="runes" childIsFragment="true"></list>
77+
78+---
79+
80+## `! zap` (special)
81+
82+<list dataPath="docs/system/hoon/runes/zp" dataPreview="true" className="runes" childIsFragment="true"></list>
83+
84+</div>