a few new runes documented
commit6f78537600ec577cd17f59473b69433df1f45c8f
authorjoshuareagan <josh@tlon.io>
dateMon 15 Oct 2018, 17:24 (8 years ago)
parent70c644b
docs/reference/rune.udon+14−2
@@ -56,9 +56,9 @@ Limb and wing expressions also lack runes:
5656
5757;br;
5858
59−## `~ sig` (Hints)
59+## `+ lus` (Arms)
6060
61−;list(src "./sig");
61+;list(src "./lus");
6262
6363;br;
6464
@@ -90,4 +90,16 @@ Limb and wing expressions also lack runes:
9090
9191;list(src "./mic");
9292
93+;br;
94+
95+## `~ sig` (Hints)
96+
97+;list(src "./sig");
98+
99+;br;
100+
101+## Terminators (`--` and `==`)
102+
103+;list(src "./terminators");
104+
93105==
docs/reference/rune/bar/vat.udonnew file+22
@@ -0,0 +1,22 @@
1+:- :~ navhome/'/docs/'
2+ next/'true'
3+ sort/'11'
4+ title/'|@ "barvat"'
5+ ==
6+;>
7+
8+# `|@ "barvat"`
9+
10+[%brvt p=(map term hoon)]: Form a 'wet' core `[battery payload]` with subject as the payload.
11+
12+## Produces
13+
14+A wet core with battery `p`. Payload is the subject.
15+
16+## Syntax
17+
18+Regular: *battery*.
19+
20+## Discussion
21+
22+The `|@` rune is just like the `|%` rune except that instead of producing a 'dry' core, it produces a 'wet' one. This allows for type polymorphism of its arms, using 'genericity'. See [Advanced types](../../../advanced).
docs/reference/rune/cen/col.udonnew file+43
@@ -0,0 +1,43 @@
1+:- :~ navhome/'/docs/'
2+ next/'true'
3+ sort/'9'
4+ title/'%: "cencol"'
5+ ==
6+;>
7+
8+# `%: "cencol"`
9+
10+`[%cncl p=hoon q=(list hoon)]`: call gate `p` with sample `q`.
11+
12+## Syntax
13+
14+Regular: *1-fixed* then *running*.
15+
16+```
17+%: p=hoon r=hoon s=hoon ... z=hoon ==
18+```
19+
20+## Discussion
21+
22+`p` is the gate to be called, and a noun is constructed from `r` through `z` and passed to `p`. If there is only one subexpression after `p`, its product is the sample. Otherwise a cell is constructed from the whole series of subexpressions after `p`, and that is the sample.
23+
24+When `%:` is used in tall-form syntax, the series of expressions after `p` must be terminated with `==`.
25+
26+## Examples
27+
28+```
29+> %: add 22 33 ==
30+55
31+
32+> =adder |= a=(list @)
33+ =+ c=0
34+ |-
35+ ?~ a c
36+ $(c (add i.a c), a t.a)
37+
38+> %: adder 22 33 44 ~ ==
39+99
40+
41+> %:(adder 22 33 44 ~)
42+99
43+```
docs/reference/rune/ket/dot.udonnew file+47
@@ -0,0 +1,47 @@
1+:- :~ navhome/'/docs/'
2+ next/'true'
3+ sort/'7'
4+ title/'^. "ketdot"'
5+ ==
6+;>
7+
8+# `^. "ketdot"`
9+
10+`[%ktdt p=hoon q=hoon]`: typecast on value produced by passing `q` to `p`.
11+
12+## Expands to
13+
14+```
15+^+(%:(p q) q)
16+```
17+
18+## Syntax
19+
20+Regular: *2-fixed*.
21+
22+```
23+^. p=hoon q=hoon
24+```
25+
26+## Discussion
27+
28+`p` produces a gate and q is any Hoon expression.
29+
30+`^.` is particularly useful when `p` is a gate that 'cleans up' the type information about some piece of data. For example, `limo` is used to turn a raw noun of the appropriate shape into a genuine list. Hence we can use `^.` to cast with `limo` and similar gates, ensuring that the product has the desired type.
31+
32+## Examples
33+
34+```
35+> =mylist [11 22 33 ~]
36+
37+> ?~(mylist ~ i.mylist)
38+mint-vain
39+
40+> =mylist ^.(limo mylist)
41+
42+> ?~(mylist ~ i.mylist)
43+11
44+
45+> ?~(mylist ~ t.mylist)
46+~[22 33]
47+```
docs/reference/rune/terminators.udonnew file+14
@@ -0,0 +1,14 @@
1+:- :~ navhome/'/docs/'
2+ navuptwo/'true'
3+ sort/'15'
4+ title/'Terminators -- and =='
5+ ==
6+;>
7+
8+# Terminators
9+
10+The `--` and `==` are used as terminators: `--` for core expressions, and `==` for terminating a 'running' or 'jogging' series of Hoon expressions.
11+
12+## Runes
13+
14+;list(datapreview "true", classname "runes");
docs/reference/rune/terminators/hephep.udonnew file+35
@@ -0,0 +1,35 @@
1+:- :~ navhome/'/docs/'
2+ next/'true'
3+ sort/'1'
4+ title/'-- "hephep"'
5+ ==
6+;>
7+
8+# `-- "hephep"`
9+
10+## Syntax
11+
12+The `--` rune is used to indicate the end of a core expression.
13+
14+## Discussion
15+
16+The `|%`, `|_`, and `|^` runes are used to create cores that can have arbitrarily many arms. When you have defined all the desired arms in a core expression (using the `++`, `+$`, and `+*` runes), use `--` to terminate the expression.
17+
18+## Examples
19+
20+```
21+> =num |%
22+ ++ two 2
23+ ++ add-two |=(a=@ (add 2 a))
24+ ++ double |=(a=@ (mul 2 a))
25+ --
26+
27+> two.num
28+2
29+
30+> (add-two.num 12)
31+14
32+
33+> (double.num 12)
34+24
35+```
docs/reference/rune/terminators/tistis.udonnew file+47
@@ -0,0 +1,47 @@
1+:- :~ navhome/'/docs/'
2+ next/'true'
3+ sort/'2'
4+ title/'== "tistis"'
5+ ==
6+;>
7+
8+# `== "tistis"`
9+
10+## Syntax
11+
12+The `==` rune is used to indicate the end of a 'jogging' or 'running' series of Hoon expressions.
13+
14+## Discussion
15+
16+Certain runes are used to create expressions that may include arbitrarily many subexpressions. Such expressions are terminated with the `==` rune. For example, the `:*` and `:~` runes are used to create a cell of any length. (The latter is just like the former except that it adds a null value at the end of the cell.) For another example, the `%=` rune used used to make arbitrarily many changes to a given wing value.
17+
18+## Examples
19+
20+```
21+> :* 2
22+ 3
23+ 4
24+ 5
25+ 6
26+ ==
27+[2 3 4 5 6]
28+
29+> :~ 2
30+ 3
31+ 4
32+ 5
33+ 6
34+ ==
35+[2 3 4 5 6 ~]
36+
37+> =values [a=12 b=14 c=16 d=18 e=20]
38+
39+> %= values
40+ a 13
41+ b 15
42+ c 17
43+ d 19
44+ e 21
45+ ==
46+[a=13 b=15 c=17 d=19 e=21]
47+```