on master help sign in
added Sail runes and others
commit59c5929797574221cd5ef6107dfb6a85303280be authorjoshuareagan <josh@tlon.io> dateTue 16 Oct 2018, 16:33 (8 years ago) parent6f78537
8 files changed+327−2
docs/reference/rune.udon+1−1 docs/reference/rune/ket/col.udon+42 docs/reference/rune/ket/hep.udon+1−1 docs/reference/rune/ket/pad.udon+59 docs/reference/rune/ket/tar.udon+57 docs/reference/rune/mic/lus.udon+51 docs/reference/rune/mic/tar.udon+63 docs/reference/rune/mic/tis.udon+53
docs/reference/rune.udon+1−1
@@ -98,7 +98,7 @@ Limb and wing expressions also lack runes:
9898
9999;br;
100100
101−## Terminators (`--` and `==`)
101+## `--`, `==` (Terminators)
102102
103103;list(src "./terminators");
104104
docs/reference/rune/ket/col.udonnew file+42
@@ -0,0 +1,42 @@
1+:- :~ navhome/'/docs/'
2+ next/'true'
3+ sort/'10'
4+ title/'^: "ketcol"'
5+ ==
6+;>
7+
8+# `^: "ketcol"`
9+
10+`[%ktcl p=spec]`: 'factory' gate for type `p`.
11+
12+## Produces
13+
14+A gate that returns the sample value if it's of the correct type, but crashes otherwise.
15+
16+## Syntax
17+
18+Regular: *1-fixed*.
19+
20+## Discussion
21+
22+In older versions of Hoon, a 'mold' was an idempotent gate that was guaranteed to produce a noun of that type. If an input value wasn't of the correct type, the bunt value of that type was returned. (See `^*`.)
23+
24+`^:` is used to produce a gate that is much like a mold, except that instead of producing a bunt value when the input value is of the wrong type, it crashes.
25+
26+## Examples
27+
28+```
29+> ^: @
30+< 1.goa
31+ { *
32+ {our/@p now/@da eny/@uvJ}
33+ <19.hqf 23.byz 5.mzd 36.apb 119.zmz 238.ipu 51.mcd 93.glm 74.dbd 1.qct $141>
34+ }
35+>
36+
37+> (^:(@) 22)
38+22
39+
40+> (^:(@) [22 33])
41+ford: %ride failed to execute:
42+```
docs/reference/rune/ket/hep.udon+1−1
@@ -12,7 +12,7 @@
1212## Expands to
1313
1414```
15−^+(*p q)
15+^+(^*(p) q)
1616```
1717
1818## Syntax
docs/reference/rune/ket/pad.udonnew file+59
@@ -0,0 +1,59 @@
1+:- :~ navhome/'/docs/'
2+ next/'true'
3+ sort/'9'
4+ title/'^& "ketpad"'
5+ ==
6+;>
7+
8+# `^& "ketpad"`
9+
10+`[%ktpd p=hoon]`: convert a core to a zinc core (covariant).
11+
12+## Produces
13+
14+`p` as a zinc core; crash if `p` isn't a gold or zinc core.
15+
16+## Syntax
17+
18+Regular: *1-fixed*.
19+
20+## Discussion
21+
22+A zinc core has a read-only sample and an opaque context. See [Advanced types](../../../advanced).
23+
24+## Examples
25+
26+The prettyprinter shows the core metal in the arm labels `1.xoz` and `1&xoz` below (`.` is gold, `&` is zinc):
27+
28+```
29+> |=(@ 1)
30+< 1.xoz
31+ { @
32+ {our/@p now/@da eny/@uvJ}
33+ <19.hqf 23.byz 5.mzd 36.apb 119.zmz 238.ipu 51.mcd 93.glm 74.dbd 1.qct $141>
34+ }
35+>
36+
37+> ^&(|=(@ 1))
38+< 1&xoz
39+ { @
40+ {our/@p now/@da eny/@uvJ}
41+ <19.hqf 23.byz 5.mzd 36.apb 119.zmz 238.ipu 51.mcd 93.glm 74.dbd 1.qct $141>
42+ }
43+>
44+```
45+
46+You can read from the sample of a zinc core, but not change it:
47+
48+```
49+> =mycore ^&(|=(a=@ 1))
50+
51+> a.mycore
52+0
53+
54+> mycore(a 22)
55+-tack.a
56+-find.a
57+ford: %slim failed:
58+ford: %ride failed to compute type:
59+```
docs/reference/rune/ket/tar.udonnew file+57
@@ -0,0 +1,57 @@
1+:- :~ navhome/'/docs/'
2+ next/'true'
3+ sort/'8'
4+ title/'^* "kettar"'
5+ ==
6+;>
7+
8+# `^* "kettar"`
9+
10+`[%kttr p=spec]`: Produce example type value.
11+
12+## Produces
13+
14+A default value (i.e., 'bunt value') of the type `p`.
15+
16+## Syntax
17+
18+Regular: *1-fixed*.
19+
20+```
21+^* p=spec
22+```
23+
24+Irregular: `*p`.
25+
26+`p` is any structure expression.
27+
28+## Examples
29+
30+Regular:
31+
32+```
33+> ^* @
34+0
35+
36+> ^* %baz
37+%baz
38+
39+> ^* ^
40+[0 0]
41+
42+> ^* ?
43+%.y
44+```
45+
46+Irregular:
47+
48+```
49+> *@
50+0
51+
52+> *^
53+[0 0]
54+
55+> *tape
56+""
57+```
docs/reference/rune/mic/lus.udonnew file+51
@@ -0,0 +1,51 @@
1+:- :~ navhome/'/docs/'
2+ next/'true'
3+ sort/'5'
4+ title/';+ "miclus"'
5+ ==
6+;>
7+
8+# `;+ "miclus"`
9+
10+make an XML node (Sail)
11+
12+## Produces
13+
14+A noun that can be rendered as single XML node.
15+
16+## Syntax
17+
18+*1-fixed*
19+
20+```
21+;+ p=hoon
22+```
23+
24+`p` is a Hoon expression.
25+
26+## Discussion
27+
28+This is a Sail rune. Sail is a part of Hoon used for generating a static website using the appropriate render pipeline. See the [Sail tutorial](../../../../tutorial/sail).
29+
30+In Sail you can produce a single `<p>` node very simply in the following way:
31+
32+```
33+> ;p: This will be rendered as an XML node.
34+[[%p ~] [[%$ [%$ "This will be rendered as an XML node."] ~] ~] ~]
35+```
36+
37+One thing that is interesting about Sail is how you can use arbitrary Hoon expressions to choose from among several nodes to render. This is done with the `;+` rune.
38+
39+## Examples
40+
41+```
42+> ;+ ?: (gth 3 2)
43+ ;p: This is the node for 'yes'.
44+ ;p: This is the node for 'no'.
45+[[[%p ~] [[%$ [%$ "This is the node for 'yes'."] ~] ~] ~] ~]
46+
47+> ;+ ?: (gth 2 3)
48+ ;p: This is the node for 'yes'.
49+ ;p: This is the node for 'no'.
50+[[[%p ~] [[%$ [%$ "This is the node for 'no'."] ~] ~] ~] ~]
51+```
docs/reference/rune/mic/tar.udonnew file+63
@@ -0,0 +1,63 @@
1+:- :~ navhome/'/docs/'
2+ next/'true'
3+ sort/'7'
4+ title/';* "mictar"'
5+ ==
6+;>
7+
8+# `;* "mictar"`
9+
10+make a list of XML nodes from a tuple (Sail)
11+
12+## Produces
13+
14+A list of nouns, each of which can be rendered as an XML node.
15+
16+## Syntax
17+
18+*running*
19+
20+```
21+;* p=hoon q=hoon ... z=hoon ==
22+```
23+
24+`p`-`z` are Hoon expressions.
25+
26+## Discussion
27+
28+This is a Sail rune. Sail is a part of Hoon used for generating a static website using the appropriate render pipeline. See the [Sail tutorial](../../../../tutorial/sail).
29+
30+In Sail you can produce a single `<p>` node very simply in the following way:
31+
32+```
33+> ;p: This will be rendered as an XML node.
34+[[%p ~] [[%$ [%$ "This will be rendered as an XML node."] ~] ~] ~]
35+```
36+
37+Sometimes you need a list of such nodes, usually produced with the `;*` rune. But to use this rune appropriately you must first put the desired nodes together with `;=`.
38+
39+## Examples
40+
41+```
42+> ;* ?: (gth 3 2)
43+ ;= ;p: This is node 1 of 'yes'.
44+ ;p: This is node 2 of 'yes'.
45+ ==
46+ ;= ;p: This is node 1 of 'no'.
47+ ;p: This is node 2 of 'no'.
48+ ==
49+[ [[%p ~] [[%$ [%$ "This is node 1 of 'yes'."] ~] ~] ~]
50+ [[[%p ~] [[%$ [%$ "This is node 2 of 'yes'."] ~] ~] ~] ~]
51+]
52+
53+> ;* ?: (gth 2 3)
54+ ;= ;p: This is node 1 of 'yes'.
55+ ;p: This is node 2 of 'yes'.
56+ ==
57+ ;= ;p: This is node 1 of 'no'.
58+ ;p: This is node 2 of 'no'.
59+ ==
60+[ [[%p ~] [[%$ [%$ "This is node 1 of 'no'."] ~] ~] ~]
61+ [[[%p ~] [[%$ [%$ "This is node 2 of 'no'."] ~] ~] ~] ~]
62+]
63+```
docs/reference/rune/mic/tis.udonnew file+53
@@ -0,0 +1,53 @@
1+:- :~ navhome/'/docs/'
2+ next/'true'
3+ sort/'6'
4+ title/';= "mictis"'
5+ ==
6+;>
7+
8+# `;= "mictis"`
9+
10+make a tuple of XML nodes (Sail)
11+
12+## Produces
13+
14+A tuple of nouns, each of which can be rendered as an XML node.
15+
16+## Syntax
17+
18+*running*
19+
20+```
21+;= p=hoon q=hoon ... z=hoon ==
22+```
23+
24+`p`-`z` are Hoon expressions.
25+
26+## Discussion
27+
28+This is a Sail rune. Sail is a part of Hoon used for generating a static website using the appropriate render pipeline. See the [Sail tutorial](../../../../tutorial/sail).
29+
30+In Sail you can produce a single `<p>` node very simply in the following way:
31+
32+```
33+> ;p: This will be rendered as an XML node.
34+[[%p ~] [[%$ [%$ "This will be rendered as an XML node."] ~] ~] ~]
35+```
36+
37+Sometimes you need a list of such nodes, usually produced with the `;*` rune. But to use this rune appropriately you must first put the desired nodes together with `;=`.
38+
39+(See [`;*`](./tar).)
40+
41+## Examples
42+
43+```
44+> ;= ;p: This is the first node.
45+ ;p: This is the second.
46+ ;p: Here is the last one.
47+ ==
48+[ [[%p ~] [[%$ [%$ "This is the first node."] ~] ~] ~]
49+ [[%p ~] [[%$ [%$ "This is the second."] ~] ~] ~]
50+ [[%p ~] [[%$ [%$ "Here is the last one."] ~] ~] ~]
51+ ~
52+]
53+```