on master help sign in
reworking the library
commitdb40e512c8738e87d7c5c95da81bc29da43a3fcc authorGalen Wolfe-Pauly <root@office-for.com> dateThu 25 Feb 2016, 13:44 (11 years ago) parent5fad682
41 files changed+83−198
docs/system/hoon/library.md−3 docs/system/hoon/library/0.md+2−2 docs/system/hoon/library/1.md+7−3 docs/system/hoon/library/2a.md+2−2 docs/system/hoon/library/2b.md+2−2 docs/system/hoon/library/2c.md+2−2 docs/system/hoon/library/2da.md+2−2 docs/system/hoon/library/2db.md+2−2 docs/system/hoon/library/2dc.md+2−2 docs/system/hoon/library/2dd.md+2−2 docs/system/hoon/library/2ea.md+2−2 docs/system/hoon/library/2eb.md+2−2 docs/system/hoon/library/2ec.md+2−2 docs/system/hoon/library/2ed.md+2−2 docs/system/hoon/library/2ee.md+2−2 docs/system/hoon/library/2ef.md+2−2 docs/system/hoon/library/2eg.md+2−2 docs/system/hoon/library/2eh.md+2−2 docs/system/hoon/library/2ei.md+2−2 docs/system/hoon/library/2ej.md+2−2 docs/system/hoon/library/2ek.md+2−2 docs/system/hoon/library/2el.md+2−2 docs/system/hoon/library/2em.md+2−2 docs/system/hoon/library/2en.md+2−2 docs/system/hoon/library/2eo.md+2−2 docs/system/hoon/library/2ep.md+2−2 docs/system/hoon/library/2ew.md+2−2 docs/system/hoon/library/2ex.md+2−2 docs/system/hoon/library/2ey.md+2−2 docs/system/hoon/library/2ez.md+2−2 docs/system/hoon/library/3ba.md+2−2 docs/system/hoon/library/3bb.md+2−2 docs/system/hoon/library/3bc.md+2−2 docs/system/hoon/library/3bd.md+2−2 docs/system/hoon/library/3be.md+2−2 docs/system/hoon/library/3bf.md+2−2 docs/system/hoon/library/3bg.md+2−2 docs/system/hoon/library/3bh.md+2−2 docs/system/hoon/library/3bi.md+2−2 docs/system/hoon/runes.md+2−2 docs/system/hoon/runes/basics.md−116
docs/system/hoon/library.md−3
@@ -6,6 +6,3 @@ Library
66========
77
88<list dataPreview="true" titlesOnly="true"></list>
9−
10−
11−<search/>
docs/system/hoon/library/0.md+2−2
@@ -1,5 +1,5 @@
1−volume 0, Kelvin Versioning.
2−===========================
1+0 Kelvin Versioning
2+===================
33
44### `++hoon`
55
docs/system/hoon/library/1.md+7−3
@@ -1,7 +1,9 @@
1−volume 1, Hoon Structures
2−=========================
1+1 Hoon Structures
2+=================
33
4−------------------------------------------------------------------------
4+<toc noHeader="true" match="h3" preview="p"></toc>
5+
6+<div id="toc">
57
68### `++abel`
79
@@ -2235,3 +2237,5 @@ See also: `++ju`, `++by`, `++map`, `++set`
22352237 {[p=%a q={1 2}] [p=%b q={5 4 3}]}
22362238
22372239------------------------------------------------------------------------
2240+
2241+</div>
docs/system/hoon/library/2a.md+2−2
@@ -1,5 +1,5 @@
1−2a - basic unsigned math
2−========================
1+2a basic unsigned math
2+======================
33
44### `++add`
55
docs/system/hoon/library/2b.md+2−2
@@ -1,5 +1,5 @@
1−chapter 2b, basic containers
2−============================
1+2b basic containers
2+===================
33
44Section 2bA, units
55------------------
docs/system/hoon/library/2c.md+2−2
@@ -1,5 +1,5 @@
1−chapter 2c, simple noun surgery
2−===============================
1+2c simple noun surgery
2+======================
33
44section 2cA, bit surgery
55------------------------
docs/system/hoon/library/2da.md+2−2
@@ -1,5 +1,5 @@
1−section 2dA, sets
2−=================
1+2dA sets
2+========
33
44### `++apt`
55
docs/system/hoon/library/2db.md+2−2
@@ -1,5 +1,5 @@
1−section 2dB, maps
2−=================
1+2dB maps
2+========
33
44### `++ept`
55
docs/system/hoon/library/2dc.md+2−2
@@ -1,5 +1,5 @@
1−section 2dC, queues
2−===================
1+2dC queues
2+==========
33
44### `++to`
55
docs/system/hoon/library/2dd.md+2−2
@@ -1,5 +1,5 @@
1−section 2dD, casual containers
2−==============================
1+2dD casual containers
2+=====================
33
44### `++mo`
55
docs/system/hoon/library/2ea.md+2−2
@@ -1,5 +1,5 @@
1−section 2eA, packing
2−====================
1+2eA packing
2+===========
33
44### `++cue`
55
docs/system/hoon/library/2eb.md+2−2
@@ -1,5 +1,5 @@
1−section 2eB, parsing (tracing)
2−==============================
1+2eB parsing (tracing)
2+=====================
33
44### `++last`
55
docs/system/hoon/library/2ec.md+2−2
@@ -1,5 +1,5 @@
1−section 2eC, parsing (custom rules)
2−===================================
1+2eC parsing (custom rules)
2+==========================
33
44### `++cold`
55
docs/system/hoon/library/2ed.md+2−2
@@ -1,5 +1,5 @@
1−section 2eD
2−===========
1+2eD parsing (combinators)
2+=========================
33
44### `++bend`
55
docs/system/hoon/library/2ee.md+2−2
@@ -1,5 +1,5 @@
1−section 2ee, parsing (composers)
2−================================
1+2ee parsing (composers)
2+=======================
33
44### `++bass`
55
docs/system/hoon/library/2ef.md+2−2
@@ -1,5 +1,5 @@
1−section 2eF, parsing (ascii)
2−============================
1+2eF parsing (ascii)
2+===================
33
44### `++ace`
55
docs/system/hoon/library/2eg.md+2−2
@@ -1,5 +1,5 @@
1−section 2eG, parsing (whitespace)
2−=================================
1+2eG parsing (whitespace)
2+========================
33
44### `++dog`
55
docs/system/hoon/library/2eh.md+2−2
@@ -1,5 +1,5 @@
1−section 2eH, parsing (idioms)
2−=============================
1+2eH parsing (idioms)
2+====================
33
44### `++alf`
55
docs/system/hoon/library/2ei.md+2−2
@@ -1,5 +1,5 @@
1−section 2eI, parsing (external)
2−===============================
1+2eI parsing (external)
2+======================
33
44### `++rash`
55
docs/system/hoon/library/2ej.md+2−2
@@ -1,5 +1,5 @@
1−section 2eJ, formatting (basic text)
2−====================================
1+2eJ formatting (basic text)
2+===========================
33
44### `++cass`
55
docs/system/hoon/library/2ek.md+2−2
@@ -1,5 +1,5 @@
1−section 2eK, formatting (layout)
2−================================
1+2eK formatting (layout)
2+=======================
33
44### `++re`
55
docs/system/hoon/library/2el.md+2−2
@@ -1,5 +1,5 @@
1−section 2eL, formatting (path)
2−==============================
1+2eL formatting (path)
2+=====================
33
44### `++ab`
55
docs/system/hoon/library/2em.md+2−2
@@ -1,5 +1,5 @@
1−section 2eM, regular-expressions
2−================================
1+2eM regular-expressions
2+=======================
33
44### `++pars`
55
docs/system/hoon/library/2en.md+2−2
@@ -1,5 +1,5 @@
1−section 2eN, pseudo-cryptography
2−================================
1+2eN pseudo-cryptography
2+=======================
33
44### `++un`
55
docs/system/hoon/library/2eo.md+2−2
@@ -1,5 +1,5 @@
1−section 2eO, virtualization
2−===========================
1+2eO virtualization
2+==================
33
44### `++mack`
55
docs/system/hoon/library/2ep.md+2−2
@@ -1,5 +1,5 @@
1−section 2eP, diff
2−=================
1+2eP diff
2+========
33
44A- more or less low priority and/or currently in the wrong section
55anyway.
docs/system/hoon/library/2ew.md+2−2
@@ -1,5 +1,5 @@
1−section 2eW, lite number theory
2−===============================
1+2eW lite number theory
2+======================
33
44### `++egcd`
55
docs/system/hoon/library/2ex.md+2−2
@@ -1,5 +1,5 @@
1−section 2eX, jetted crypto
2−==========================
1+2eX jetted crypto
2+=================
33
44------------------------------------------------------------------------
55
docs/system/hoon/library/2ey.md+2−2
@@ -1,5 +1,5 @@
1−section 2eY, SHA-256
2−====================
1+2eY SHA-256
2+===========
33
44### `++shad`
55
docs/system/hoon/library/2ez.md+2−2
@@ -1,5 +1,5 @@
1−section 2eZ, OLD rendering
2−==========================
1+2eZ OLD rendering
2+=================
33
44### `++show`
55
docs/system/hoon/library/3ba.md+2−2
@@ -1,5 +1,5 @@
1−section 3bA, lite number theory
2−===============================
1+3bA lite number theory
2+======================
33
44### `++fu`
55
docs/system/hoon/library/3bb.md+2−2
@@ -1,5 +1,5 @@
1−section 3bB, cryptosuites
2−=========================
1+3bB cryptosuites
2+================
33
44### `++crua`
55
docs/system/hoon/library/3bc.md+2−2
@@ -1,5 +1,5 @@
1−section 3bC, Gregorian UTC
2−==========================
1+3bC Gregorian UTC
2+=================
33
44### `++dawn`
55
docs/system/hoon/library/3bd.md+2−2
@@ -1,5 +1,5 @@
1−section 3bD, JSON and XML
2−=========================
1+3bD JSON and XML
2+================
33
44### `++moon`
55
docs/system/hoon/library/3be.md+2−2
@@ -1,5 +1,5 @@
1−section 3bE, tree sync
2−======================
1+3bE tree sync
2+=============
33
44### `++invert-miso`
55
docs/system/hoon/library/3bf.md+2−2
@@ -1,5 +1,5 @@
1−section 3bF, filesystem interface
2−=================================
1+3bF filesystem interface
2+========================
33
44### `++feel`
55
docs/system/hoon/library/3bg.md+2−2
@@ -1,5 +1,5 @@
1−section 3bG, URL handling
2−=========================
1+3bG URL handling
2+================
33
44### `++deft`
55
docs/system/hoon/library/3bh.md+2−2
@@ -1,5 +1,5 @@
1−section 3bH, names etc
2−======================
1+3bH names etc
2+=============
33
44### `++clan`
55
docs/system/hoon/library/3bi.md+2−2
@@ -1,5 +1,5 @@
1−section 3bI, Arvo models
2−========================
1+3bI Arvo models
2+===============
33
44### `++acru`
55
docs/system/hoon/runes.md+2−2
@@ -5,9 +5,9 @@ sort: 1
55Runes
66=====
77
8−#### Make friends with them.
8+#### Hoon has no reserved words. Instead we use ASCII pairs we call runes.
99
10−This is the full list of runes.
10+#### This is the complete index.
1111
1212<div class="book">
1313
docs/system/hoon/runes/basics.mddeleted−116
@@ -1,116 +0,0 @@
1−--
2−sort: 0
3−---
4−
5−Rune basics
6−-----------
7−
8−For example, the rune `?:`, pronounced "wutcol", is a rune that accepts
9−three `++twig` expressions to form an "if-then-else statement," where
10−`p` is the predicate, `q` is the "then" statement, and `r` is the "else"
11−statement:
12−
13− [%wtcl p=twig q=twig r=twig]
14−
15−In a program, it is used like so:
16−
17− ++ add
18− |= [a=@ b=@]
19− ^- @
20− ?: =(0 a) b
21− $(a (dec a), b +(b))
22−
23−Here the `=(0 a)` is `p`, the `b` is `q`, and the bottom line is the
24−`r`.
25−
26−There are several benefits to using runes in lieu of reserved words.
27−First, it prevents the programmer from accidentally misusing a reserved
28−word as a variable name, which also allows her to be sure that any word
29−in her progam is an identifier. Next, as the first ASCII symbol of the
30−rune digraphs bears semantic significance, the programmer can look at
31−any rune and immediately have a basic, intuitive understanding as to
32−what it does.
33−
34−Next, rune syntax addresses several issues that arise in other
35−languages. First, it produces cleaner, less verbose code that
36−conveniently flows downward. To highlight the verbosity Hoon avoids by
37−implementing runes, here is the C equivalent of the `++add` source code
38−printed above:
39−
40− attribute add {
41− function(left-operand: atom, right-operand: atom)
42− produce atom
43− if equals(0, left-operand) {
44− right-operand
45− } else {
46− recurse(left-operand (decrement left-operand)),
47− right-operand (increment right-operand))
48− }
49− }
50−
51−What is more, Hoon solves two problems that arise in functional
52−programming languages with very deep expression trees: first, the
53−collection of huge piles of closing parens at the end of large blocks;
54−and second, the fact that the depth of expression trees are thus bounded
55−by the width of the text box, as subexpressions tend to be indented.
56−Some languages solve the bracket-terminator problem by parsing
57−whitespace in order to use indentation to express tree depth:
58−
59− ?:
60− &
61− 47
62− 52
63−
64−While this is actually valid Hoon, it does not solve the width problem.
65−
66−To address this problem, most Hoon `++twigs` have a short, fixed
67−fan-out. Thus, the parser does not need significant whitespace nor a
68−terminator to determine how many twigs follow a `?:`--it already knows
69−that the answer is three. A smart parser allows the Hoon programmer to
70−format her code using a [backstep pattern]() that allows her to descend
71−into a deep tree without losing right margin.
72−
73−Lastly, but perhaps most significantly, code is meant to be seen, and
74−not read. Anyone who has even slight experience coding Hoon will tell
75−you that they can understand and connect with properly formatted Hoon
76−code on a deeper, more intuitive level that cannot be explained but must
77−be experienced. One doesn't read `++add`, she sees it.
78−
79−Names and Categories
80−--------------------
81−
82−While the second glyph in a rune means little or nothing, the first
83−defines a rough semantic category:
84−
85− | bar Core construction
86− $ buc Tile construction
87− % cen Invocations
88− : col Tuple construction
89− . dot Nock operations
90− # hax Pretty printing
91− ^ ket Type conversions
92− ; sem Composers (and XML generators)
93− ~ sig Hints
94− = tis Subject modifiers
95− ? wut Conditionals, booleans, and tests
96− ! zap Special operations
97−
98−As shown above, each glyph has its own monosyllabic name, designed to be
99−pronounced quickly in combination with another glyph to form a rune
100−name. As languages are often read-aloud, this saves the programmer from
101−having to say "dollar sign, question mark"--"bucwut" is much more
102−compact.
103−
104−Irregular pronuncations
105−-----------------------
106−
107−To avoid a few tongue-twisters, some runes have irregular pronunciations
108−that should be noted:
109−
110− -- hephep phep
111− +- lushep slep
112− ++ luslus slus
113− == tistis stet
114−
115−Note: these runes are not members of any of the categories above, but
116−are mostly used to....