on master help sign in
Merge branch 'cleanorg' of https://github.com/urbit/docs into cleanorg
commit7e26f167c27c79a03997a86e9b2376ede8c9b92e authorHenry Ault <henry@tlon.io> dateThu 24 Mar 2016, 17:14 (11 years ago) parent98321ef12ba071
15 files changed+143−399
docs.md+2−1 docs/system/hoon/core/twig/mold.md+2−2 docs/system/hoon/runes/bc/bcbr.md−41 docs/system/hoon/runes/bc/bccb.md+18−44 docs/system/hoon/runes/bc/bccl.md+18−36 docs/system/hoon/runes/bc/bccn.md+14−45 docs/system/hoon/runes/bc/bchp.md+15 docs/system/hoon/runes/bc/bcls.md−57 docs/system/hoon/runes/bc/bcpm.md+15−21 docs/system/hoon/runes/bc/bcpt.md+22 docs/system/hoon/runes/bc/bctr.md−41 docs/system/hoon/runes/bc/bcts.md+14−52 docs/system/hoon/runes/bc/bcwt.md+15−34 docs/system/hoon/runes/br/brcb.md+7−24 docs/walkthroughs/shell.md+1−1
docs.md+2−1
@@ -1,5 +1,6 @@
11---
22anchor: none
3+footer: true
34---
45
56<div class="lead">
@@ -8,5 +9,5 @@ anchor: none
89</div>
910
1011<div class="sections lead-offset">
11− <kids></kids>
12+ <kids grid="true"></kids>
1213</div>
docs/system/hoon/core/twig/mold.md+2−2
@@ -10,7 +10,7 @@ molds are often called "structures.")
1010
1111## Overview
1212
13−While Hoon can't check this property statically, any true mold
13+While Hoon can't check this property statically, a proper mold
1414is a *rectifier*: an idempotent function across all nouns. If
1515the sample of a gate has span `%noun`, and its body obeys the
1616constraint that for any x, `=((mold x) (mold (mold x)))`, it's a
@@ -129,7 +129,7 @@ Similarly, `%foo` is the number `7.303.014` or `0x6f.6f66`;
129129Translation:
130130
131131```
132−{a b c}` :bank(a b c)
132+{a b c} :bank(a b c)
133133a/b :coat(a b)
134134?(a b c) :pick(a b c)
135135_a :shoe(a)
docs/system/hoon/runes/bc/bcbr.mddeleted−41
@@ -1,41 +0,0 @@
1−`$| bucbar`
2−===========
3−
4−Union between atom and cell.
5−
6−[mold]() that's a union of an atom `p` and cell `q`.
7−`$|` is similar to [`$?`](), but is more strict in that in
8−only contains one atom mold and one cell mold.
9−
10−### Produces
11−
12−A validator function that validates atoms as mold `p` and cells as mold `q`.
13−
14−### Accepts
15−
16−`p` is a `mold` of an atom and `q` is a `mold` of a cell.
17−
18−### Tall form
19−
20− $| p
21− q
22−
23−### Wide form
24−
25− $|(p q)
26−
27−### Examples
28−
29− ~zod/try=> ($|(@t [@ud @ux]) 'hello')
30− 'hello'
31− ~zod/try=> (,$|(@ [@t @ud]) 44 44)
32− [',' 44]
33− ~zod/try=> *$|(~ [~ u=@])
34− ~
35−
36− ++ list |* a=_,* :: null-terminated list
37− $|(~ [i=a t=(list a)]) ::
38−
39−In `++list`, `$|` specifies that every element in a noun that can be
40−cast to a `++list` is either the atom `~` or the cell
41−`[i=a t=(list a)]`.
docs/system/hoon/runes/bc/bccb.md+18−44
@@ -1,52 +1,26 @@
1−`$_ buccab`
2−===========
1+# `:shoe, $_, "buccab", {$shoe p/twig}`
32
4−Unbunt (create mold from example).
3+Type as a single example.
54
6−Uses a [++twig]() `p` to produce a [mold]() for the type (span)
7−of `p`. The validator function has a default value of `p`. Used
8−when either (1) you want the default value of a mold to be
9−anything other than the standard default value ([bunt]()), or (2)
10−you are referring to a type (span) that is difficult or
11−cumbersome to describe in any way other than by example.
5+Product: a mold whose product is always `p`.
126
13−Produces
14−--------
7+Regular form: *1-fixed*.
158
16−A mold whose span is the span of `p`.
9+Irregular form:
10+```
11+_%foo :shoe(%foo)
12+```
1713
18−Accepts
19−-------
14+Example:
15+```
16+~zod:dojo> =a :shoe([%foobar %moobaz])
2017
21−`p` is a twig.
18+~zod:dojo> (a %foo %bar)
19+[%foobar %moobaz]
2220
23−Tall form
24−---------
21+~zod:dojo> `a`[%foobar %moobaz]
22+[%foobar %moobaz]
2523
26− $_ p
27−
28−Wide form
29−---------
30−
31− $_(p)
32−
33−Irregular form
34−--------------
35−
36− _p
37−
38−Examples
39−--------
40−
41− ~zod/try=> *_12
42− 12
43− ~zod/try=> *@
44− 0
45− ~zod/try=> :type; *_12
46− 12
47− @ud
48− ~zod/try=> ^-(_(add 2 2) 'a')
49− 97
50−
51−Here, see how the default value of `_12` is 12, whereas the
52−default value of `@`--the type ([span]()) of `12`--is `0`.
24+~zod:dojo $:a
25+[%foobar %moobaz]
26+```
docs/system/hoon/runes/bc/bccl.md+18−36
@@ -1,44 +1,26 @@
1−`$: buccol`
2−===========
1+# `:bank, $:, "buccol", {$bank p/(list moss)}`
32
4−Tuple of molds.
3+Tuple of molds
54
6−Produces
7−--------
5+Product: a mold which applies the tuple `p` to its sample.
86
9−A validator function that validates a tuple of nouns against a tuple of [mold]()s.
7+Regular form: *running*.
108
11−Accepts
12−--------
9+Irregular form:
10+```
11+{a b c} :bank(a b c)
12+```
1313
14−`p` is a list of molds.
14+Example:
15+```
16+~zod:dojo> =a :bank(p/@ud q/@tas)
1517
16−Tall form
17−---------
18+~zod:dojo> (a 33 %foo)
19+[p=33 q=%foo]
1820
19− $: i.p
20− i.t.p
21− i.t.t.p
22− ==
21+~zod:dojo> `a`[33 %foo]
22+[p=33 q=%foo]
2323
24−Wide form
25−---------
26−
27− $:(i.p i.t.p i.t.t.p)
28−
29−Irregular form
30−--------------
31−
32− {i.p i.t.p i.t.t.p}
33−
34−Examples
35−--------
36−
37− ~zod/try=> *[1 2]
38− [%1 %2]
39− ~zod/try=> (,$:(1 2) "ham")
40− [%1 %2]
41− ~zod/try=> (,[1 2] "ham")
42− [%1 %2]
43− ~zod/try=> (,[@ 2] "ham")
44− [104 %2]
24+~zod:dojo> $:a
25+[p=0 q=%$]
26+```
docs/system/hoon/runes/bc/bccn.md+14−45
@@ -1,52 +1,21 @@
1−`$% buccen`
2−====
1+# `:book, $%, "buctis", {$book p/(list moss)}`
32
4−Tagged union.
3+Tagged union
54
6−Produces a [mold]() of a tagged union of a list of case pairs.
5+Product: a mold producing the tagged union of the molds in
6+`p`, all of which must be of the form `:bank(stem bulb)`, where
7+`stem` is an atomic mold.
78
8−Produces
9−--------
9+Regular form: *running*.
1010
11−A validator function that uses the value's [head]() as a tag to select a mold validate the tail of the value.
11+Examples:
1212
13−Accepts
14−-------
13+```
14+~zod:dojo> =a :book({$foo p/@ud q/@ud} {$bar p/@ud})
1515
16−A list of cells of molds whose heads must be a [cube]().
16+~zod:dojo> (a [%bar 37])
17+[%bar p=37]
1718
18−Tall form
19−---------
20−
21− $% p
22− q
23− ==
24−
25−Examples
26−--------
27−
28− ~zod/try=> $%([%& @p] [%| @t])
29− <1.dhe [* @n <246.qra 41.uuw 374.glo 100.rip 1.ypj %164>]>
30− ~zod/try=> *$%([%& @p] [%| @t])
31− [%.y ~zod]
32− ~zod/try=> :type; *$%([%& @p] [%| @t])
33− [%.y ~zod]
34− {[%.y @p] [%.n @t]}
35− ~zod/try=> :type; *(each ,@p ,@t)
36− [%.y p=~zod]
37− {[%.y p=@p] [%.n p=@t]}
38− ~zod/try=> $%(~ [%a 1])
39− ~ <syntax error at [1 13]>
40− ~zod/try=> $%([%~ ~] [%a 1])
41− <1.yck [* @n <246.qra 41.uuw 374.glo 100.rip 1.ypj %164>]>
42− ~zod/try=> *$%([%~ ~] [%a 1])
43− [~ ~]
44−
45− ++ foot $% [%ash p=twig] :: dry, geometric
46− [%elm p=twig] :: wet, generic
47− [%oak ~] :: XX not used
48− [%yew p=(map term foot)] :: XX not used
49− ==
50−
51−In `++foot`, `$%` creates a list of possible cases. That is, a `++foot`
52−can be either `%ash`, `%elm`, `%oak` or `%yew`.
19+~zod:dojo> $:a
20+[%foo p=0 q=0]~
21+```
docs/system/hoon/runes/bc/bchp.mdnew file+15
@@ -0,0 +1,15 @@
1+# `:lamb, $-, "buchep", {$lamb p/moss q/moss}`
2+
3+Function type.
4+
5+Product: a mold producing a gate accepting
6+
7+Regular form: *2-fixed*.
8+
9+Example:
10+```
11+~zod:dojo> =a :lamb($foo $bar)
12+
13+~zod:dojo> ($:a %foo)
14+%bar
15+```
docs/system/hoon/runes/bc/bcls.mddeleted−57
@@ -1,57 +0,0 @@
1−`$+ buclus`
2−===========
3−
4−Type of function (type signature).
5−
6−Produces a [mold]() for a function that accepts `p` and produces `q`. Used when we want to use the type of a function that we do not want to compute.
7−
8−Reduces to `$_(|+(p _q))`.
9−
10−Produces
11−--------
12−
13−A mold whose [span]() is used to validate the types of functions.
14−
15−Accepts
16−-------
17−
18−`p` is the mold of the [argument]() ([sample]()) and `q` is a mold of the product.
19−
20−Tall form
21−---------
22−
23− $+ p q
24−
25−Wide form
26−---------
27−
28− $+(p q)
29−
30−Examples
31−--------
32−
33− ++ sort :: quicksort
34− ~/ %sort
35− !:
36− |* [a=(list) b=$+([* *] ?)]
37− => .(a ^.(homo a))
38− |- ^+ a
39− ?~ a ~
40− %+ weld
41− $(a (skim t.a |=(c=_i.a (b c i.a))))
42− ^+ t.a
43− [i.a $(a (skim t.a |=(c=_i.a !(b c i.a))))]
44−
45−In ++sort, `$+` is a mold for a comparator gate, which takes two nouns
46−and produces a loobean.
47−
48− ~zod/try=> |=(a=@ (add 2 a))
49− <1.sgg [a=@ [[@da @ta] [@p @ta] *''] @n <246.qra 41.uuw 374.glo 100.rip 1.ypj %164>]>
50− ~zod/try=> `$+(@ @)`|=(a=@ (add 2 a))
51− <1|crm [@ [[@da @ta] [@p @ta] *''] @n <246.qra 41.uuw 374.glo 100.rip 1.ypj %164>]>
52− ~zod/try=> +<:|=(a=@ (add 2 a))
53− a=0
54− ~zod/try=> +<:`$+(@ @)`|=(a=@ (add 2 a))
55− ! -axis.6
56− ! peek-park
57− ! exit
docs/system/hoon/runes/bc/bcpm.md+15−21
@@ -1,30 +1,24 @@
1−`$& bucpam`
2−===========
1+# `:bush, $&, "bucpam", {$bush p/moss q/moss}`
32
43Union of two cells: one w/cellular head & other w/atomic head.
54
6−Produces a [mold]() that's a union between two different kinds of noun: a cell whose head is a cell (`p`), and cell whose head is an atom (`q`). Its default value ([bunt]()) is the value of `q`. One important use of `$&` is to implement autocons in [`++twig`]().
5+Product: a mold which applies `p` if the head of its sample
6+is a cell, `q` if the head of its sample is a cell.
77
8−Produces
9−--------
8+Regular form: *2-fixed*.
109
11−A validator function that uses mold `p` to validate cells whose head is a cell, and `q` to validate cells whose head is an atom. Default value is the bunt of `q`.
10+Example:
11+```
12+~zod:dojo> =a :book({$foo p/@ud q/@ud} {$bar p/@ud})
1213
13−Accepts
14−-------
14+~zod:dojo> =b :bush({a a} a)
1515
16−A mold of a cell whose head is a cell `p` and a mold of a cell whose head is an atom `q`.
16+~zod:dojo> (b [[%bar 33] [%foo 19 22]])
17+[[%bar p=33] [%foo p=19 q=22]]
1718
18−Tall form
19−---------
19+~zod:dojo> (b [%foo 19 22])
20+[%foo p=19 q=22]
2021
21− $& p
22− q
23−
24−Wide form
25−---------
26−
27− $&(p q)
28−
29−Examples
30−--------
22+~zod:dojo> $:b
23+[%bar p=0]
24+```
docs/system/hoon/runes/bc/bcpt.mdnew file+22
@@ -0,0 +1,22 @@
1+# `:claw, $@, "bucpat", {$claw p/moss q/moss}`
2+
3+Type: either an atom or a cell.
4+
5+Product: a mold which applies `p` if its sample is an atom,
6+`q` if its sample is a cell.
7+
8+Regular form: *2-fixed*.
9+
10+Example:
11+```
12+~zod:dojo> =a :claw($foo :bank(p/$bar q/@ud))
13+
14+~zod:dojo> (a %foo)
15+%foo
16+
17+~zod:dojo> `a`[%bar 99]
18+[p=%bar q=99]
19+
20+~zod:dojo> $:a
21+[%foo p=0 q=0]
22+```
docs/system/hoon/runes/bc/bctr.mddeleted−41
@@ -1,41 +0,0 @@
1−`$* buctar`
2−===========
3−
4−Bunt (default value).
5−
6−Produces the default value ([bunt]()) of [mold]() `p`. Does so as a compile-time constant if possible. If not possible, then it is produced dynamically.
7−
8−Produces
9−--------
10−
11−The default value (bunt) of the mold `p`.
12−
13−Accepts
14−-------
15−
16−A mold `p`.
17−
18−Tall form
19−---------
20−
21− $* p
22−
23−Wide form
24−---------
25−
26− $*(p)
27−
28−Irregular form
29−--------------
30−
31− *p
32−
33−Examples
34−--------
35−
36− ~zod/try=> *@t
37− ''
38− ~zod/try=> *[@p @ux]
39− [~zod 0x0]
40− ~zod/try=> *(list ,@)
41− ~
docs/system/hoon/runes/bc/bcts.md+14−52
@@ -1,59 +1,21 @@
1−`$= buctis`
2−===========
1+# `:coat, $=, "buctis", {$coat p/@tas q/moss}`
32
4−Add variable name.
3+Add variable name
54
6−Wraps a [++face]() around another [mold](). Used primarily to add variable names to values.
5+Product: a mold which puts the label `p` on the mold `q`.
76
8−Produces
9−--------
7+Regular form: *2-fixed*.
108
11−Produces a [mold]() that validates the input value with `q`, before adding face `p`.
9+Irregular form:
10+```
11+a/b :coat(a b)
12+```
1213
13−Accepts
14−------
15−
16−`p` is a [++term]().
17−
18−`q` is a mold.
19−
20−Tall form
21−---------
22−
23− $= p
24− q
25−
26−Wide form
27−---------
28−
29− $=(p q)
30−
31−Irregular form
32−--------------
33−
34− `p=q`
35−note: this is only the case when in mold syntax
36−
37−Examples
38−--------
39−
40−`a=*` parses as `[%bark %a %noun]`.
41−
42− ~zod/try=> *$=(a @)
43− a=0
44− ~zod/try=> :type; *$=(a @)
45− a=0
46− a=@
47− ~zod/try=> :type; *a=@
48− a=0
49− a=@
50− ~zod/try=> :type; *a=[1 2]
51− a=[%1 %2]
52− a=[%1 %2]
53−
54− |_ [hid=bowl vat=axle]
55− ...
56− --
57−See here how we wrap the faces 'hid' and 'vat' around the two [sample]() (input) types of the core above. We can now refer to our 'bowl' and 'vat' by these names.
14+Examples:
5815
16+```
17+~zod:dojo> =a :coat(p $foo)
5918
19+~zod:dojo> (a %bar)
20+p=%foo
21+```
docs/system/hoon/runes/bc/bcwt.md+15−34
@@ -1,42 +1,23 @@
1−`$? bucwut`
2−===========
1+# `:pick, $?, "bucwut", {$? p/(list moss)}`
32
4−Union of types.
3+Generalized type union.
54
6−Produce a union between a non-empty list of [mold]()s `p`. The default value ([bunt]()) is the value of the first element.
5+Product: a mold which tries each of the alternatives in `p`.
76
8−Produces
9−--------
7+Note: Use `:pick` only if none of `:book` (`$%`), `:claw` (`$@`) or `:bush` (`$&`) applies.
108
11−A validator function that keeps trying to validate a value using every mold in `p` from left to right. On a success, the value is produced. If no mold in `p` succeeds, the default value of the last element in `p` is produced.
9+Regular form: *running*.
1210
13−Accepts
14−-------
11+Example:
12+```
13+~zod:dojo> =a :pick($foo $bar $baz)
1514
16−`p` is a [++list]() of mold.
15+~zod:dojo> (a %baz)
16+%baz
1717
18−Tall form
19−---------
18+~zod:dojo> (a [37 45])
19+%foo
2020
21− $? p
22− q
23− ==
24−
25−Irregular form
26−--------------
27−
28− ?(p q)
29−
30−Examples
31−--------
32−
33− ++ base ?([%atom p=odor] %noun %cell %bean %null) :: axils, @ * ^ ? ~
34−
35−`++base`, `?` (the irregular form of `$?`) specifies a list of
36−orthoganal cases for the `%axil` mold.
37−
38− ~zod/try=> *?(%a %b %c)
39− %a
40− ~zod/try=> :type; *?(%a %b %c)
41− %a
42− {%a %b %c}
21+~zod:dojo> $:a
22+$foo
23+```
docs/system/hoon/runes/br/brcb.md+7−24
@@ -2,37 +2,20 @@
22sort: 7
33---
44
5−`|_ barcab`
6−===========
5+# `:door`, `|_`, "buccab", `{$door p/moss q/(map term twig)}`
76
87Door: core with sample (input values).
98
10−Similar to [`|%`](), but also takes input data (aka [sample]())
9+Product: a core whose sample is `p` and arms are `q`.
10+
11+Regular form: *1-fixed*, then *battery*
12+
13+Similar to `|%`, but also takes input data (aka sample)
1114available within the entire core. Cores of this type are called doors.
1215Moreover, `|_` only accepts [dry or `%elm`]() arms--in other words,
1316type checking on these arms is performed on the input before computation.
1417
15−Produces
16−--------
17−
18−Twig: `[%brcb p=twig q=(map term foot)]`
19−
20−Accepts
21−-------
22−
23−`p` is a a [mold](). `q` is a [`++map`]() with [`++term`]() keys and
24−[`++foot`]() values.
25−
26−Tall form
27−---------
28−
29− |_ p
30− ++ p.n.q
31− q.n.q
32− --
33−
34−Examples
35−--------
18+Examples:
3619
3720 /~zod/try=> =mol
3821 |_ a=@ud
docs/walkthroughs/shell.md+1−1
@@ -248,7 +248,7 @@ The current urbit plot. Read-only.
248248
249249The hood is the system daemon. See `gen/hood` and `app/hood`.
250250
251−**`|hi`** - Sends a direct message. Sort of like `finger`. Accepts an urbit name (`@p`) and a string (`cord`).
251+**`|hi`** - Sends a direct message. Sort of like Unix `write`. Accepts an urbit name (`@p`) and a string (`cord`).
252252
253253 ~your-urbit:dojo> |hi ~doznec 'you there?'
254254